VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkGraphMapper.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 Copyright 2008 Sandia Corporation. 00017 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00018 the U.S. Government retains certain rights in this software. 00019 -------------------------------------------------------------------------*/ 00032 #ifndef __vtkGraphMapper_h 00033 #define __vtkGraphMapper_h 00034 00035 #include "vtkMapper.h" 00036 00037 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars. 00038 00039 class vtkActor2D; 00040 class vtkMapArrayValues; 00041 class vtkCamera; 00042 class vtkFollower; 00043 class vtkGraph; 00044 class vtkGlyph3D; 00045 class vtkGraphToPolyData; 00046 class vtkIconGlyphFilter; 00047 class vtkCellCenters; 00048 class vtkPolyData; 00049 class vtkPolyDataMapper; 00050 class vtkPolyDataMapper2D; 00051 class vtkLookupTable; 00052 class vtkTransformCoordinateSystems; 00053 class vtkTexture; 00054 class vtkTexturedActor2D; 00055 class vtkVertexGlyphFilter; 00056 class vtkViewTheme; 00057 00058 00059 00060 class VTK_RENDERING_EXPORT vtkGraphMapper : public vtkMapper 00061 { 00062 public: 00063 static vtkGraphMapper *New(); 00064 vtkTypeMacro(vtkGraphMapper,vtkMapper); 00065 void PrintSelf(ostream& os, vtkIndent indent); 00066 void Render(vtkRenderer *ren, vtkActor *act); 00067 00069 00070 void SetVertexColorArrayName(const char* name); 00071 const char* GetVertexColorArrayName(); 00073 00075 00076 void SetColorVertices(bool vis); 00077 bool GetColorVertices(); 00078 void ColorVerticesOn(); 00079 void ColorVerticesOff(); 00081 00083 00087 void SetScaledGlyphs(bool arg); 00088 vtkGetMacro(ScaledGlyphs,bool); 00089 vtkBooleanMacro(ScaledGlyphs, bool); 00091 00093 00094 vtkSetStringMacro(ScalingArrayName); 00095 vtkGetStringMacro(ScalingArrayName); 00097 00099 00100 void SetEdgeVisibility(bool vis); 00101 bool GetEdgeVisibility(); 00102 vtkBooleanMacro(EdgeVisibility, bool); 00104 00106 00107 void SetEdgeColorArrayName(const char* name); 00108 const char* GetEdgeColorArrayName(); 00110 00112 00113 void SetColorEdges(bool vis); 00114 bool GetColorEdges(); 00115 void ColorEdgesOn(); 00116 void ColorEdgesOff(); 00118 00120 00121 vtkSetStringMacro(EnabledEdgesArrayName); 00122 vtkGetStringMacro(EnabledEdgesArrayName); 00124 00126 00127 vtkSetMacro(EnableEdgesByArray,int); 00128 vtkGetMacro(EnableEdgesByArray,int); 00129 vtkBooleanMacro(EnableEdgesByArray,int); 00131 00133 00134 vtkSetStringMacro(EnabledVerticesArrayName); 00135 vtkGetStringMacro(EnabledVerticesArrayName); 00137 00139 00141 vtkSetMacro(EnableVerticesByArray,int); 00142 vtkGetMacro(EnableVerticesByArray,int); 00143 vtkBooleanMacro(EnableVerticesByArray,int); 00145 00147 00148 void SetIconArrayName(const char* name); 00149 const char* GetIconArrayName(); 00151 00155 void AddIconType(char *type, int index); 00156 00158 void ClearIconTypes(); 00159 00161 00163 void SetIconSize(int *size); 00164 int *GetIconSize(); 00166 00169 void SetIconAlignment(int alignment); 00170 00172 00173 vtkTexture *GetIconTexture(); 00174 void SetIconTexture(vtkTexture *texture); 00176 00178 00179 void SetIconVisibility(bool vis); 00180 bool GetIconVisibility(); 00181 vtkBooleanMacro(IconVisibility, bool); 00183 00185 00186 vtkGetMacro(VertexPointSize,float); 00187 void SetVertexPointSize(float size); 00189 00191 00192 vtkGetMacro(EdgeLineWidth,float); 00193 void SetEdgeLineWidth(float width); 00195 00197 virtual void ApplyViewTheme(vtkViewTheme* theme); 00198 00202 void ReleaseGraphicsResources(vtkWindow *); 00203 00205 unsigned long GetMTime(); 00206 00208 00209 void SetInput(vtkGraph *input); 00210 vtkGraph *GetInput(); 00212 00214 00216 virtual double *GetBounds(); 00217 virtual void GetBounds(double* bounds) 00218 { Superclass::GetBounds(bounds); } 00220 00222 00223 vtkGetObjectMacro(EdgeLookupTable, vtkLookupTable); 00224 vtkGetObjectMacro(VertexLookupTable, vtkLookupTable); 00226 00227 protected: 00228 vtkGraphMapper(); 00229 ~vtkGraphMapper(); 00230 00232 00233 vtkGetStringMacro(VertexColorArrayNameInternal); 00234 vtkSetStringMacro(VertexColorArrayNameInternal); 00235 vtkGetStringMacro(EdgeColorArrayNameInternal); 00236 vtkSetStringMacro(EdgeColorArrayNameInternal); 00237 char* VertexColorArrayNameInternal; 00238 char* EdgeColorArrayNameInternal; 00240 00241 char* EnabledEdgesArrayName; 00242 char* EnabledVerticesArrayName; 00243 int EnableEdgesByArray; 00244 int EnableVerticesByArray; 00245 00246 vtkGetStringMacro(IconArrayNameInternal); 00247 vtkSetStringMacro(IconArrayNameInternal); 00248 char* IconArrayNameInternal; 00249 00250 //BTX 00251 vtkSmartPointer<vtkGlyph3D> CircleGlyph; 00252 vtkSmartPointer<vtkGlyph3D> CircleOutlineGlyph; 00253 00254 vtkSmartPointer<vtkGraphToPolyData> GraphToPoly; 00255 vtkSmartPointer<vtkVertexGlyphFilter> VertexGlyph; 00256 vtkSmartPointer<vtkIconGlyphFilter> IconGlyph; 00257 vtkSmartPointer<vtkMapArrayValues> IconTypeToIndex; 00258 vtkSmartPointer<vtkTransformCoordinateSystems> IconTransform; 00259 00260 vtkSmartPointer<vtkPolyDataMapper> EdgeMapper; 00261 vtkSmartPointer<vtkPolyDataMapper> VertexMapper; 00262 vtkSmartPointer<vtkPolyDataMapper> OutlineMapper; 00263 vtkSmartPointer<vtkPolyDataMapper2D> IconMapper; 00264 00265 vtkSmartPointer<vtkActor> EdgeActor; 00266 vtkSmartPointer<vtkActor> VertexActor; 00267 vtkSmartPointer<vtkActor> OutlineActor; 00268 vtkSmartPointer<vtkTexturedActor2D> IconActor; 00269 //ETX 00270 00271 // Color maps 00272 vtkLookupTable* EdgeLookupTable; 00273 vtkLookupTable* VertexLookupTable; 00274 00275 virtual void ReportReferences(vtkGarbageCollector*); 00276 00277 // see algorithm for more info 00278 virtual int FillInputPortInformation(int port, vtkInformation* info); 00279 00280 private: 00281 vtkGraphMapper(const vtkGraphMapper&); // Not implemented. 00282 void operator=(const vtkGraphMapper&); // Not implemented. 00283 00284 // Helper function 00285 vtkPolyData* CreateCircle(bool filled); 00286 00287 float VertexPointSize; 00288 float EdgeLineWidth; 00289 bool ScaledGlyphs; 00290 char* ScalingArrayName; 00291 }; 00292 00293 #endif 00294 00295