VTK
dox/Domains/Chemistry/vtkProteinRibbonFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkProteinRibbonFilter.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 
00016 #ifndef _vtkProteinRibbonFilter_h
00017 #define _vtkProteinRibbonFilter_h
00018 
00029 #include "vtkDomainsChemistryModule.h" // for export macro
00030 #include "vtkPolyDataAlgorithm.h"
00031 
00032 #include "vtkColor.h" // For vtkColor3ub.
00033 #include <map> // For element to color map.
00034 
00035 class vtkVector3f;
00036 class vtkStringArray;
00037 
00038 class VTKDOMAINSCHEMISTRY_EXPORT vtkProteinRibbonFilter
00039   : public vtkPolyDataAlgorithm
00040 {
00041 public:
00042   vtkTypeMacro(vtkProteinRibbonFilter, vtkPolyDataAlgorithm)
00043   void PrintSelf(ostream& os, vtkIndent indent);
00044 
00045   static vtkProteinRibbonFilter* New();
00046 
00048 
00049   vtkGetMacro(CoilWidth, float);
00050   vtkSetMacro(CoilWidth, float);
00052 
00054 
00055   vtkGetMacro(HelixWidth, float);
00056   vtkSetMacro(HelixWidth, float);
00058 
00060 
00061   vtkGetMacro(SubdivideFactor, int);
00062   vtkSetMacro(SubdivideFactor, int);
00064 
00066 
00068   vtkGetMacro(DrawSmallMoleculesAsSpheres, bool);
00069   vtkSetMacro(DrawSmallMoleculesAsSpheres, bool);
00071 
00073 
00074   vtkGetMacro(SphereResolution, int);
00075   vtkSetMacro(SphereResolution, int);
00077 
00078 protected:
00079   vtkProteinRibbonFilter();
00080   ~vtkProteinRibbonFilter();
00081 
00082   int FillInputPortInformation(int, vtkInformation*);
00083 
00084   int RequestData(vtkInformation *,
00085                   vtkInformationVector **,
00086                   vtkInformationVector *);
00087 
00088   void CreateThinStrip(vtkPolyData* poly, vtkUnsignedCharArray *pointsColors,
00089                        vtkPoints* p, std::vector<std::pair<vtkVector3f, bool> >& p1,
00090                        std::vector<std::pair<vtkVector3f, bool> >& p2,
00091                        std::vector<vtkColor3ub> &colors);
00092 
00093   void CreateAtomAsSphere(vtkPolyData* poly, vtkUnsignedCharArray *pointsColors,
00094                           double *pos, const vtkColor3ub& color, float radius,
00095                           float scale);
00096 
00097   static std::vector<vtkVector3f>* Subdivide(std::vector<std::pair<vtkVector3f, bool> >& p,
00098                                              int div);
00099 
00100   void SetColorByAtom(std::vector<vtkColor3ub>& colors, vtkStringArray* atomTypes);
00101 
00102   void SetColorByStructure(std::vector<vtkColor3ub>& colors,
00103                            vtkStringArray* atomTypes, vtkUnsignedCharArray* ss,
00104                            const vtkColor3ub& helixColor,
00105                            const vtkColor3ub& sheetColor);
00106 
00107   std::map<std::string, vtkColor3ub> ElementColors;
00108 
00109   float CoilWidth;
00110   float HelixWidth;
00111   int SphereResolution;
00112   int SubdivideFactor;
00113   bool DrawSmallMoleculesAsSpheres;
00114 
00115 private:
00116   vtkProteinRibbonFilter(const vtkProteinRibbonFilter&);  // Not implemented.
00117   void operator=(const vtkProteinRibbonFilter&);  // Not implemented.
00118 };
00119 
00120 #endif // _vtkProteinRibbonFilter_h