Changeset 2328 for trunk/packages
- Timestamp:
- Aug 2, 2011, 12:27:27 PM (13 years ago)
- Location:
- trunk/packages/vizservers/vtkvis
- Files:
-
- 1 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/Makefile.in
r2320 r2328 129 129 ColorMap.o: ColorMap.h RpMolecule.h Trace.h 130 130 PPMWriter.o: PPMWriter.h Trace.h 131 RpContour2D.o: RpContour2D.h RpVtk DataSet.h Trace.h132 RpContour3D.o: RpContour3D.h RpVtk DataSet.h Trace.h133 RpGlyphs.o: RpGlyphs.h RpVtk DataSet.h ColorMap.h Trace.h134 RpHeightMap.o: RpHeightMap.h RpVtk DataSet.h Trace.h135 RpLIC.o: RpLIC.h RpVtk DataSet.h Trace.h RpVtkRenderServer.h136 RpMolecule.o: RpMolecule.h RpMoleculeData.h RpVtk DataSet.h ColorMap.h Trace.h137 RpPolyData.o: RpPolyData.h RpVtk DataSet.h Trace.h138 RpPseudoColor.o: RpPseudoColor.h RpVtk DataSet.h Trace.h139 RpStreamlines.o: RpStreamlines.h RpVtk DataSet.h Trace.h140 RpVolume.o: RpVolume.h RpVtk DataSet.h ColorMap.h Trace.h131 RpContour2D.o: RpContour2D.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h 132 RpContour3D.o: RpContour3D.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h 133 RpGlyphs.o: RpGlyphs.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h 134 RpHeightMap.o: RpHeightMap.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h 135 RpLIC.o: RpLIC.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h RpVtkRenderServer.h 136 RpMolecule.o: RpMolecule.h RpMoleculeData.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h 137 RpPolyData.o: RpPolyData.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h 138 RpPseudoColor.o: RpPseudoColor.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h 139 RpStreamlines.o: RpStreamlines.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h 140 RpVolume.o: RpVolume.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h 141 141 RpVtkDataSet.o: RpVtkDataSet.h Trace.h 142 142 RpVtkRenderer.o: RpVtkRenderer.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h -
trunk/packages/vizservers/vtkvis/RpContour2D.cpp
r2317 r2328 26 26 27 27 Contour2D::Contour2D() : 28 _dataSet(NULL), 29 _numContours(0), 30 _edgeWidth(1.0f), 31 _opacity(1.0) 28 VtkGraphicsObject(), 29 _numContours(0) 32 30 { 33 31 _dataRange[0] = 0; 34 32 _dataRange[1] = 1; 35 _edgeColor[0] = 0;36 _edgeColor[1] = 0;37 _edgeColor[2] = 0;38 33 } 39 34 … … 68 63 69 64 /** 70 * \brief Returns the DataSet this Contour2D renders71 */72 DataSet *Contour2D::getDataSet()73 {74 return _dataSet;75 }76 77 /**78 * \brief Get the VTK Prop for the contour lines79 */80 vtkProp *Contour2D::getProp()81 {82 return _contourActor;83 }84 85 /**86 65 * \brief Create and initialize a VTK Prop to render isolines 87 66 */ 88 67 void Contour2D::initProp() 89 68 { 90 if (_contourActor == NULL) { 91 _contourActor = vtkSmartPointer<vtkActor>::New(); 92 _contourActor->GetProperty()->EdgeVisibilityOn(); 93 _contourActor->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]); 94 _contourActor->GetProperty()->SetLineWidth(_edgeWidth); 95 _contourActor->GetProperty()->SetOpacity(_opacity); 96 _contourActor->GetProperty()->SetAmbient(.2); 97 _contourActor->GetProperty()->LightingOff(); 69 if (_prop == NULL) { 70 _prop = vtkSmartPointer<vtkActor>::New(); 71 vtkProperty *property = getActor()->GetProperty(); 72 property->EdgeVisibilityOn(); 73 property->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]); 74 property->SetLineWidth(_edgeWidth); 75 property->SetOpacity(_opacity); 76 property->SetAmbient(.2); 77 property->LightingOff(); 98 78 } 99 79 } … … 189 169 _contourMapper->SetResolveCoincidentTopologyToPolygonOffset(); 190 170 _contourMapper->SetInputConnection(_contourFilter->GetOutputPort()); 191 _contourActor->SetMapper(_contourMapper);171 getActor()->SetMapper(_contourMapper); 192 172 } 193 173 … … 263 243 264 244 /** 265 * \brief Turn on/off rendering of this contour set266 */267 void Contour2D::setVisibility(bool state)268 {269 if (_contourActor != NULL) {270 _contourActor->SetVisibility((state ? 1 : 0));271 }272 }273 274 /**275 * \brief Get visibility state of the contour set276 *277 * \return Is contour set visible?278 */279 bool Contour2D::getVisibility() const280 {281 if (_contourActor == NULL) {282 return false;283 } else {284 return (_contourActor->GetVisibility() != 0);285 }286 }287 288 /**289 * \brief Set opacity used to render contour lines290 */291 void Contour2D::setOpacity(double opacity)292 {293 _opacity = opacity;294 if (_contourActor != NULL)295 _contourActor->GetProperty()->SetOpacity(opacity);296 }297 298 /**299 * \brief Set RGB color of contour lines300 */301 void Contour2D::setEdgeColor(float color[3])302 {303 _edgeColor[0] = color[0];304 _edgeColor[1] = color[1];305 _edgeColor[2] = color[2];306 if (_contourActor != NULL)307 _contourActor->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]);308 }309 310 /**311 * \brief Set pixel width of contour lines (may be a no-op)312 */313 void Contour2D::setEdgeWidth(float edgeWidth)314 {315 _edgeWidth = edgeWidth;316 if (_contourActor != NULL)317 _contourActor->GetProperty()->SetLineWidth(_edgeWidth);318 }319 320 /**321 245 * \brief Set a group of world coordinate planes to clip rendering 322 246 * … … 329 253 } 330 254 } 331 332 /**333 * \brief Turn on/off lighting of this object334 */335 void Contour2D::setLighting(bool state)336 {337 if (_contourActor != NULL)338 _contourActor->GetProperty()->SetLighting((state ? 1 : 0));339 } -
trunk/packages/vizservers/vtkvis/RpContour2D.h
r2261 r2328 17 17 #include <vector> 18 18 19 #include "RpVtk DataSet.h"19 #include "RpVtkGraphicsObject.h" 20 20 21 21 namespace Rappture { … … 25 25 * \brief 2D Contour lines (isolines) 26 26 */ 27 class Contour2D {27 class Contour2D : public VtkGraphicsObject { 28 28 public: 29 29 Contour2D(); 30 30 virtual ~Contour2D(); 31 31 32 void setDataSet(DataSet *dataset); 32 virtual const char *getClassName() const 33 { 34 return "Contour2D"; 35 } 33 36 34 DataSet *getDataSet();37 virtual void setDataSet(DataSet *dataset); 35 38 36 v tkProp *getProp();39 virtual void setClippingPlanes(vtkPlaneCollection *planes); 37 40 38 41 void setContours(int numContours); … … 46 49 const std::vector<double>& getContourList() const; 47 50 48 void setVisibility(bool state);49 50 bool getVisibility() const;51 52 void setOpacity(double opacity);53 54 void setEdgeColor(float color[3]);55 56 void setEdgeWidth(float edgeWidth);57 58 void setClippingPlanes(vtkPlaneCollection *planes);59 60 void setLighting(bool state);61 62 51 private: 63 void initProp(); 64 void update(); 65 66 DataSet *_dataSet; 52 virtual void initProp(); 53 virtual void update(); 67 54 68 55 int _numContours; … … 70 57 double _dataRange[2]; 71 58 72 float _edgeColor[3];73 float _edgeWidth;74 double _opacity;75 59 vtkSmartPointer<vtkContourFilter> _contourFilter; 76 60 vtkSmartPointer<vtkPolyDataMapper> _contourMapper; 77 vtkSmartPointer<vtkActor> _contourActor;78 61 }; 79 62 -
trunk/packages/vizservers/vtkvis/RpContour3D.cpp
r2319 r2328 26 26 27 27 Contour3D::Contour3D() : 28 _dataSet(NULL), 29 _numContours(0), 30 _edgeWidth(1.0f), 31 _opacity(1.0), 32 _lighting(true) 28 VtkGraphicsObject(), 29 _numContours(0) 33 30 { 34 31 _dataRange[0] = 0; 35 32 _dataRange[1] = 1; 36 _color[0] = 0; 37 _color[1] = 0; 38 _color[2] = 1; 39 _edgeColor[0] = 0; 40 _edgeColor[1] = 0; 41 _edgeColor[2] = 0; 33 _color[0] = 0.0f; 34 _color[1] = 0.0f; 35 _color[2] = 1.0f; 42 36 } 43 37 … … 72 66 73 67 /** 74 * \brief Returns the DataSet this Contour3D renders75 */76 DataSet *Contour3D::getDataSet()77 {78 return _dataSet;79 }80 81 /**82 * \brief Get the VTK Prop for the isosurfaces83 */84 vtkProp *Contour3D::getProp()85 {86 return _contourActor;87 }88 89 /**90 68 * \brief Create and initialize a VTK Prop to render isosurfaces 91 69 */ 92 70 void Contour3D::initProp() 93 71 { 94 if (_contourActor == NULL) { 95 _contourActor = vtkSmartPointer<vtkActor>::New(); 96 _contourActor->GetProperty()->EdgeVisibilityOff(); 97 _contourActor->GetProperty()->SetColor(_color[0], _color[1], _color[2]); 98 _contourActor->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]); 99 _contourActor->GetProperty()->SetLineWidth(_edgeWidth); 100 _contourActor->GetProperty()->SetOpacity(_opacity); 101 _contourActor->GetProperty()->SetAmbient(.2); 72 if (_prop == NULL) { 73 _prop = vtkSmartPointer<vtkActor>::New(); 74 vtkProperty *property = getActor()->GetProperty(); 75 property->EdgeVisibilityOff(); 76 property->SetColor(_color[0], _color[1], _color[2]); 77 property->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]); 78 property->SetLineWidth(_edgeWidth); 79 property->SetOpacity(_opacity); 80 property->SetAmbient(.2); 102 81 if (!_lighting) 103 _contourActor->GetProperty()->LightingOff();82 property->LightingOff(); 104 83 } 105 84 } … … 216 195 _contourMapper->SetResolveCoincidentTopologyToPolygonOffset(); 217 196 _contourMapper->SetInputConnection(_contourFilter->GetOutputPort()); 218 _contourActor->SetMapper(_contourMapper);197 getActor()->SetMapper(_contourMapper); 219 198 } 220 199 … … 317 296 318 297 /** 319 * \brief Turn on/off rendering of this contour set320 */321 void Contour3D::setVisibility(bool state)322 {323 if (_contourActor != NULL) {324 _contourActor->SetVisibility((state ? 1 : 0));325 }326 }327 328 /**329 * \brief Get visibility state of the contour set330 *331 * \return Is contour set visible?332 */333 bool Contour3D::getVisibility() const334 {335 if (_contourActor == NULL) {336 return false;337 } else {338 return (_contourActor->GetVisibility() != 0);339 }340 }341 342 /**343 * \brief Set opacity used to render isosurfaces344 */345 void Contour3D::setOpacity(double opacity)346 {347 _opacity = opacity;348 if (_contourActor != NULL)349 _contourActor->GetProperty()->SetOpacity(opacity);350 }351 352 /**353 * \brief Switch between wireframe and surface representations354 */355 void Contour3D::setWireframe(bool state)356 {357 if (_contourActor != NULL) {358 if (state) {359 _contourActor->GetProperty()->SetRepresentationToWireframe();360 _contourActor->GetProperty()->LightingOff();361 } else {362 _contourActor->GetProperty()->SetRepresentationToSurface();363 _contourActor->GetProperty()->SetLighting((_lighting ? 1 : 0));364 }365 }366 }367 368 /**369 * \brief Set RGB color of isosurfaces370 */371 void Contour3D::setColor(float color[3])372 {373 _color[0] = color[0];374 _color[1] = color[1];375 _color[2] = color[2];376 if (_contourActor != NULL)377 _contourActor->GetProperty()->SetColor(_color[0], _color[1], _color[2]);378 }379 380 /**381 * \brief Turn on/off rendering of mesh edges382 */383 void Contour3D::setEdgeVisibility(bool state)384 {385 if (_contourActor != NULL) {386 _contourActor->GetProperty()->SetEdgeVisibility((state ? 1 : 0));387 }388 }389 390 /**391 * \brief Set RGB color of isosurface edges392 */393 void Contour3D::setEdgeColor(float color[3])394 {395 _edgeColor[0] = color[0];396 _edgeColor[1] = color[1];397 _edgeColor[2] = color[2];398 if (_contourActor != NULL)399 _contourActor->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]);400 }401 402 /**403 * \brief Set pixel width of contour lines (may be a no-op)404 */405 void Contour3D::setEdgeWidth(float edgeWidth)406 {407 _edgeWidth = edgeWidth;408 if (_contourActor != NULL)409 _contourActor->GetProperty()->SetLineWidth(_edgeWidth);410 }411 412 /**413 298 * \brief Set a group of world coordinate planes to clip rendering 414 299 * … … 421 306 } 422 307 } 423 424 /**425 * \brief Turn on/off lighting of this object426 */427 void Contour3D::setLighting(bool state)428 {429 _lighting = state;430 if (_contourActor != NULL)431 _contourActor->GetProperty()->SetLighting((state ? 1 : 0));432 } -
trunk/packages/vizservers/vtkvis/RpContour3D.h
r2290 r2328 18 18 #include <vector> 19 19 20 #include "RpVtk DataSet.h"20 #include "RpVtkGraphicsObject.h" 21 21 22 22 namespace Rappture { … … 26 26 * \brief 3D Contour isosurfaces (geometry) 27 27 */ 28 class Contour3D {28 class Contour3D : public VtkGraphicsObject { 29 29 public: 30 30 Contour3D(); 31 31 virtual ~Contour3D(); 32 32 33 void setDataSet(DataSet *dataset); 33 virtual const char *getClassName() const 34 { 35 return "Contour3D"; 36 } 34 37 35 DataSet *getDataSet();38 virtual void setDataSet(DataSet *dataset); 36 39 37 v tkProp *getProp();40 virtual void setClippingPlanes(vtkPlaneCollection *planes); 38 41 39 42 void setContours(int numContours); … … 47 50 const std::vector<double>& getContourList() const; 48 51 49 void setVisibility(bool state);50 51 bool getVisibility() const;52 53 void setOpacity(double opacity);54 55 void setWireframe(bool state);56 57 52 void setLookupTable(vtkLookupTable *lut); 58 53 59 54 vtkLookupTable *getLookupTable(); 60 55 61 void setColor(float color[3]);62 63 void setEdgeVisibility(bool state);64 65 void setEdgeColor(float color[3]);66 67 void setEdgeWidth(float edgeWidth);68 69 void setClippingPlanes(vtkPlaneCollection *planes);70 71 void setLighting(bool state);72 73 56 private: 74 void initProp(); 75 void update(); 76 77 DataSet *_dataSet; 57 virtual void initProp(); 58 virtual void update(); 78 59 79 60 int _numContours; … … 81 62 double _dataRange[2]; 82 63 83 float _color[3];84 float _edgeColor[3];85 float _edgeWidth;86 double _opacity;87 bool _lighting;88 89 64 vtkSmartPointer<vtkContourFilter> _contourFilter; 90 65 vtkSmartPointer<vtkLookupTable> _lut; 91 66 vtkSmartPointer<vtkPolyDataMapper> _contourMapper; 92 vtkSmartPointer<vtkActor> _contourActor;93 67 }; 94 68 -
trunk/packages/vizservers/vtkvis/RpGlyphs.cpp
r2319 r2328 27 27 28 28 Glyphs::Glyphs() : 29 _dataSet(NULL), 30 _opacity(1.0), 31 _lighting(true), 29 VtkGraphicsObject(), 32 30 _glyphShape(ARROW), 33 31 _scaleFactor(1.0) … … 37 35 Glyphs::~Glyphs() 38 36 { 39 }40 41 /**42 * \brief Get the VTK Prop for the Glyphs43 */44 vtkProp *Glyphs::getProp()45 {46 return _prop;47 }48 49 /**50 * \brief Create and initialize a VTK Prop to render Glyphs51 */52 void Glyphs::initProp()53 {54 if (_prop == NULL) {55 _prop = vtkSmartPointer<vtkActor>::New();56 _prop->GetProperty()->EdgeVisibilityOff();57 _prop->GetProperty()->SetOpacity(_opacity);58 _prop->GetProperty()->SetAmbient(.2);59 if (!_lighting)60 _prop->GetProperty()->LightingOff();61 }62 }63 64 /**65 * \brief Specify input DataSet66 *67 * The DataSet must be a PolyData point set68 * with vectors and/or scalars69 */70 void Glyphs::setDataSet(DataSet *dataSet)71 {72 if (_dataSet != dataSet) {73 _dataSet = dataSet;74 update();75 }76 }77 78 /**79 * \brief Returns the DataSet this Glyphs renders80 */81 DataSet *Glyphs::getDataSet()82 {83 return _dataSet;84 37 } 85 38 … … 222 175 initProp(); 223 176 224 _prop->SetMapper(_pdMapper);177 getActor()->SetMapper(_pdMapper); 225 178 _pdMapper->Update(); 226 179 } … … 263 216 264 217 /** 265 * \brief Turn on/off rendering of this Glyphs266 */267 void Glyphs::setVisibility(bool state)268 {269 if (_prop != NULL) {270 _prop->SetVisibility((state ? 1 : 0));271 }272 }273 274 /**275 * \brief Get visibility state of the Glyphs276 *277 * \return Are the glyphs visible?278 */279 bool Glyphs::getVisibility()280 {281 if (_prop == NULL) {282 return false;283 } else {284 return (_prop->GetVisibility() != 0);285 }286 }287 288 /**289 * \brief Set opacity used to render the Glyphs290 */291 void Glyphs::setOpacity(double opacity)292 {293 _opacity = opacity;294 if (_prop != NULL)295 _prop->GetProperty()->SetOpacity(opacity);296 }297 298 /**299 * \brief Get opacity used to render the Glyphs300 */301 double Glyphs::getOpacity()302 {303 return _opacity;304 }305 306 /**307 218 * \brief Set a group of world coordinate planes to clip rendering 308 219 * … … 315 226 } 316 227 } 317 318 /**319 * \brief Turn on/off lighting of this object320 */321 void Glyphs::setLighting(bool state)322 {323 _lighting = state;324 if (_prop != NULL)325 _prop->GetProperty()->SetLighting((state ? 1 : 0));326 } -
trunk/packages/vizservers/vtkvis/RpGlyphs.h
r2319 r2328 18 18 #include <vtkPlaneCollection.h> 19 19 20 #include "RpVtk DataSet.h"20 #include "RpVtkGraphicsObject.h" 21 21 #include "ColorMap.h" 22 22 … … 26 26 /** 27 27 * \brief Oriented and scaled 3D glyph shapes 28 * 29 * The DataSet must be a PolyData point set 30 * with vectors and/or scalars 28 31 */ 29 class Glyphs {32 class Glyphs : public VtkGraphicsObject { 30 33 public: 31 34 enum GlyphShape { … … 44 47 virtual ~Glyphs(); 45 48 46 void setDataSet(DataSet *dataset); 49 virtual const char *getClassName() const 50 { 51 return "Glyphs"; 52 } 47 53 48 DataSet *getDataSet(); 49 50 vtkProp *getProp(); 54 virtual void setClippingPlanes(vtkPlaneCollection *planes); 51 55 52 56 void setGlyphShape(GlyphShape shape); … … 58 62 vtkLookupTable *getLookupTable(); 59 63 60 void setOpacity(double opacity);61 62 double getOpacity();63 64 void setVisibility(bool state);65 66 bool getVisibility();67 68 void setClippingPlanes(vtkPlaneCollection *planes);69 70 void setLighting(bool state);71 72 64 private: 73 void initProp(); 74 void update(); 75 76 DataSet *_dataSet; 77 78 double _opacity; 79 bool _lighting; 65 virtual void update(); 80 66 81 67 GlyphShape _glyphShape; … … 83 69 84 70 vtkSmartPointer<vtkLookupTable> _lut; 85 vtkSmartPointer<vtkActor> _prop;86 71 vtkSmartPointer<vtkGlyph3D> _glyphGenerator; 87 72 vtkSmartPointer<vtkPolyDataAlgorithm> _glyphSource; -
trunk/packages/vizservers/vtkvis/RpHeightMap.cpp
r2320 r2328 36 36 37 37 HeightMap::HeightMap() : 38 _dataSet(NULL),38 VtkGraphicsObject(), 39 39 _numContours(0), 40 _edgeWidth(1.0),41 40 _contourEdgeWidth(1.0), 42 _opacity(1.0),43 41 _warpScale(1.0), 44 42 _sliceAxis(Z_AXIS), … … 47 45 _dataRange[0] = 0.0; 48 46 _dataRange[1] = 1.0; 49 _edgeColor[0] = 0.0; 50 _edgeColor[1] = 0.0; 51 _edgeColor[2] = 0.0; 52 _contourEdgeColor[0] = 1.0; 53 _contourEdgeColor[1] = 0.0; 54 _contourEdgeColor[2] = 0.0; 47 _contourEdgeColor[0] = 1.0f; 48 _contourEdgeColor[1] = 0.0f; 49 _contourEdgeColor[2] = 0.0f; 55 50 } 56 51 … … 107 102 108 103 /** 109 * \brief Returns the DataSet this HeightMap renders 110 */ 111 DataSet *HeightMap::getDataSet() 112 { 113 return _dataSet; 104 * \brief Create and initialize VTK Props to render the colormapped dataset 105 */ 106 void HeightMap::initProp() 107 { 108 if (_dsActor == NULL) { 109 _dsActor = vtkSmartPointer<vtkActor>::New(); 110 _dsActor->GetProperty()->SetOpacity(_opacity); 111 _dsActor->GetProperty()->SetEdgeColor(_edgeColor[0], 112 _edgeColor[1], 113 _edgeColor[2]); 114 _dsActor->GetProperty()->SetLineWidth(_edgeWidth); 115 _dsActor->GetProperty()->EdgeVisibilityOff(); 116 _dsActor->GetProperty()->SetAmbient(.2); 117 _dsActor->GetProperty()->LightingOn(); 118 } 119 if (_contourActor == NULL) { 120 _contourActor = vtkSmartPointer<vtkActor>::New(); 121 _contourActor->GetProperty()->SetOpacity(_opacity); 122 _contourActor->GetProperty()->SetEdgeColor(_contourEdgeColor[0], 123 _contourEdgeColor[1], 124 _contourEdgeColor[2]); 125 _contourActor->GetProperty()->SetLineWidth(_contourEdgeWidth); 126 _contourActor->GetProperty()->EdgeVisibilityOn(); 127 _contourActor->GetProperty()->SetAmbient(.2); 128 _contourActor->GetProperty()->LightingOff(); 129 } 114 130 } 115 131 … … 372 388 _dsActor->SetMapper(_dsMapper); 373 389 374 if (_prop s== NULL) {375 _prop s = vtkSmartPointer<vtkPropAssembly>::New();376 _props->AddPart(_dsActor);377 _props->AddPart(_contourActor);390 if (_prop == NULL) { 391 _prop = vtkSmartPointer<vtkAssembly>::New(); 392 getAssembly()->AddPart(_dsActor); 393 getAssembly()->AddPart(_contourActor); 378 394 } 379 395 … … 599 615 600 616 /** 601 * \brief Get the VTK Prop for the colormapped dataset602 */603 vtkProp *HeightMap::getProp()604 {605 return _props;606 }607 608 /**609 * \brief Create and initialize VTK Props to render the colormapped dataset610 */611 void HeightMap::initProp()612 {613 if (_dsActor == NULL) {614 _dsActor = vtkSmartPointer<vtkActor>::New();615 _dsActor->GetProperty()->SetOpacity(_opacity);616 _dsActor->GetProperty()->SetEdgeColor(_edgeColor[0],617 _edgeColor[1],618 _edgeColor[2]);619 _dsActor->GetProperty()->SetLineWidth(_edgeWidth);620 _dsActor->GetProperty()->EdgeVisibilityOff();621 _dsActor->GetProperty()->SetAmbient(.2);622 _dsActor->GetProperty()->LightingOn();623 }624 if (_contourActor == NULL) {625 _contourActor = vtkSmartPointer<vtkActor>::New();626 _contourActor->GetProperty()->SetOpacity(_opacity);627 _contourActor->GetProperty()->SetEdgeColor(_contourEdgeColor[0],628 _contourEdgeColor[1],629 _contourEdgeColor[2]);630 _contourActor->GetProperty()->SetLineWidth(_contourEdgeWidth);631 _contourActor->GetProperty()->EdgeVisibilityOn();632 _contourActor->GetProperty()->SetAmbient(.2);633 _contourActor->GetProperty()->LightingOff();634 }635 }636 637 /**638 617 * \brief Get the VTK colormap lookup table in use 639 618 */ … … 728 707 729 708 /** 730 * \brief Turn on/off rendering of this HeightMap 731 */ 732 void HeightMap::setVisibility(bool state) 733 { 734 if (_dsActor != NULL) { 735 _dsActor->SetVisibility((state ? 1 : 0)); 736 } 737 if (_contourActor != NULL) { 738 _contourActor->SetVisibility((state ? 1 : 0)); 739 } 740 } 741 742 /** 743 * \brief Get visibility state of the HeightMap 744 * 745 * \return Is HeightMap visible? 746 */ 747 bool HeightMap::getVisibility() 748 { 749 if (_dsActor != NULL && 750 _dsActor->GetVisibility() != 0) { 751 return true; 752 } else if (_contourActor != NULL && 753 _contourActor->GetVisibility() != 0) { 754 return true; 755 } 756 return false; 757 } 758 759 /** 760 * \brief Set opacity used to render the HeightMap 761 */ 762 void HeightMap::setOpacity(double opacity) 763 { 764 _opacity = opacity; 765 if (_dsActor != NULL) { 766 _dsActor->GetProperty()->SetOpacity(opacity); 767 } 768 if (_contourActor != NULL) { 769 _contourActor->GetProperty()->SetOpacity(opacity); 770 } 709 * \brief Turn on/off lighting of this object 710 */ 711 void HeightMap::setLighting(bool state) 712 { 713 if (_dsActor != NULL) 714 _dsActor->GetProperty()->SetLighting((state ? 1 : 0)); 771 715 } 772 716 … … 852 796 } 853 797 854 /**855 * \brief Turn on/off lighting of this object856 */857 void HeightMap::setLighting(bool state)858 {859 if (_dsActor != NULL)860 _dsActor->GetProperty()->SetLighting((state ? 1 : 0));861 } -
trunk/packages/vizservers/vtkvis/RpHeightMap.h
r2290 r2328 20 20 #include <vtkExtractVOI.h> 21 21 #include <vtkWarpScalar.h> 22 #include <vtk PropAssembly.h>22 #include <vtkAssembly.h> 23 23 #include <vtkPolyData.h> 24 24 25 25 #include <vector> 26 26 27 #include "RpVtk DataSet.h"27 #include "RpVtkGraphicsObject.h" 28 28 29 29 namespace Rappture { … … 33 33 * \brief Color-mapped plot of data set 34 34 */ 35 class HeightMap {35 class HeightMap : public VtkGraphicsObject { 36 36 public: 37 37 enum Axis { … … 44 44 virtual ~HeightMap(); 45 45 46 void setDataSet(DataSet *dataset); 46 virtual const char *getClassName() const 47 { 48 return "HeightMap"; 49 } 47 50 48 DataSet *getDataSet();51 virtual void setDataSet(DataSet *dataset); 49 52 50 vtkProp *getProp(); 53 virtual void setLighting(bool state); 54 55 virtual void setEdgeVisibility(bool state); 56 57 virtual void setEdgeColor(float color[3]); 58 59 virtual void setEdgeWidth(float edgeWidth); 60 61 virtual void setClippingPlanes(vtkPlaneCollection *planes); 51 62 52 63 void selectVolumeSlice(Axis axis, double ratio); … … 68 79 vtkLookupTable *getLookupTable(); 69 80 70 void setVisibility(bool state);71 72 bool getVisibility();73 74 void setOpacity(double opacity);75 76 void setEdgeVisibility(bool state);77 78 void setEdgeColor(float color[3]);79 80 void setEdgeWidth(float edgeWidth);81 82 81 void setContourVisibility(bool state); 83 82 … … 86 85 void setContourEdgeWidth(float edgeWidth); 87 86 88 void setClippingPlanes(vtkPlaneCollection *planes); 87 private: 88 virtual void initProp(); 89 virtual void update(); 89 90 90 void setLighting(bool state);91 92 private:93 91 vtkAlgorithmOutput *initWarp(vtkAlgorithmOutput *input); 94 92 vtkAlgorithmOutput *initWarp(vtkPolyData *input); 95 void initProp();96 void update();97 98 DataSet * _dataSet;99 93 100 94 int _numContours; … … 106 100 float _edgeWidth; 107 101 float _contourEdgeWidth; 108 double _opacity;109 102 double _warpScale; 110 103 double _dataScale; … … 122 115 vtkSmartPointer<vtkActor> _dsActor; 123 116 vtkSmartPointer<vtkActor> _contourActor; 124 vtkSmartPointer<vtkPropAssembly> _props;125 117 }; 126 118 -
trunk/packages/vizservers/vtkvis/RpLIC.cpp
r2320 r2328 26 26 27 27 LIC::LIC() : 28 _dataSet(NULL), 29 _edgeWidth(1.0f), 30 _opacity(1.0), 31 _lighting(false), 28 VtkGraphicsObject(), 32 29 _sliceAxis(Z_AXIS) 33 30 { 34 _edgeColor[0] = 0.0f;35 _edgeColor[1] = 0.0f;36 _edgeColor[2] = 0.0f;37 31 } 38 32 39 33 LIC::~LIC() 40 34 { 41 }42 43 /**44 * \brief Get the VTK Prop for the LIC45 */46 vtkProp *LIC::getProp()47 {48 return _prop;49 35 } 50 36 … … 53 39 if (_prop == NULL) { 54 40 _prop = vtkSmartPointer<vtkActor>::New(); 55 _prop->GetProperty()->SetOpacity(_opacity); 56 _prop->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]); 57 _prop->GetProperty()->SetLineWidth(_edgeWidth); 58 _prop->GetProperty()->EdgeVisibilityOff(); 59 _prop->GetProperty()->SetAmbient(.2); 41 vtkProperty *property = getActor()->GetProperty(); 42 property->SetOpacity(_opacity); 43 property->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]); 44 property->SetLineWidth(_edgeWidth); 45 property->EdgeVisibilityOff(); 46 property->SetAmbient(.2); 60 47 if (!_lighting) 61 _prop->GetProperty()->LightingOff(); 62 } 63 } 64 65 /** 66 * \brief Specify input DataSet 67 * 68 * The DataSet must contain vectors 69 */ 70 void LIC::setDataSet(DataSet *dataSet) 71 { 72 if (_dataSet != dataSet) { 73 _dataSet = dataSet; 74 update(); 75 } 76 } 77 78 /** 79 * \brief Returns the DataSet this LIC renders 80 */ 81 DataSet *LIC::getDataSet() 82 { 83 return _dataSet; 48 property->LightingOff(); 49 } 84 50 } 85 51 … … 224 190 225 191 initProp(); 226 _prop->SetMapper(_mapper);192 getActor()->SetMapper(_mapper); 227 193 228 194 _mapper->Update(); … … 369 335 370 336 /** 371 * \brief Turn on/off rendering of this LIC372 */373 void LIC::setVisibility(bool state)374 {375 if (_prop != NULL) {376 _prop->SetVisibility((state ? 1 : 0));377 }378 }379 380 /**381 * \brief Get visibility state of the LIC382 *383 * \return Is the LIC texture visible?384 */385 bool LIC::getVisibility()386 {387 if (_prop == NULL) {388 return false;389 } else {390 return (_prop->GetVisibility() != 0);391 }392 }393 394 /**395 * \brief Set opacity used to render the LIC396 */397 void LIC::setOpacity(double opacity)398 {399 _opacity = opacity;400 if (_prop != NULL) {401 _prop->GetProperty()->SetOpacity(opacity);402 }403 }404 405 /**406 * \brief Get opacity used to render the LIC407 */408 double LIC::getOpacity()409 {410 return _opacity;411 }412 413 /**414 * \brief Turn on/off rendering of edges415 */416 void LIC::setEdgeVisibility(bool state)417 {418 if (_prop != NULL) {419 _prop->GetProperty()->SetEdgeVisibility((state ? 1 : 0));420 }421 }422 423 /**424 * \brief Set RGB color of edges425 */426 void LIC::setEdgeColor(float color[3])427 {428 _edgeColor[0] = color[0];429 _edgeColor[1] = color[1];430 _edgeColor[2] = color[2];431 if (_prop != NULL)432 _prop->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]);433 }434 435 /**436 * \brief Set pixel width of edges (may be a no-op)437 */438 void LIC::setEdgeWidth(float edgeWidth)439 {440 _edgeWidth = edgeWidth;441 if (_prop != NULL)442 _prop->GetProperty()->SetLineWidth(_edgeWidth);443 }444 445 /**446 337 * \brief Set a group of world coordinate planes to clip rendering 447 338 * … … 454 345 } 455 346 } 456 457 /**458 * \brief Turn on/off lighting of this object459 */460 void LIC::setLighting(bool state)461 {462 _lighting = state;463 if (_prop != NULL)464 _prop->GetProperty()->SetLighting((state ? 1 : 0));465 } -
trunk/packages/vizservers/vtkvis/RpLIC.h
r2320 r2328 19 19 #include <vtkLookupTable.h> 20 20 21 #include "RpVtk DataSet.h"21 #include "RpVtkGraphicsObject.h" 22 22 23 23 namespace Rappture { … … 26 26 /** 27 27 * \brief Line Integral Convolution visualization of vector fields 28 * 29 * The DataSet must contain vectors 28 30 */ 29 class LIC {31 class LIC : public VtkGraphicsObject { 30 32 public: 31 33 enum Axis { … … 38 40 virtual ~LIC(); 39 41 40 void setDataSet(DataSet *dataset); 41 42 DataSet *getDataSet(); 43 44 vtkProp *getProp(); 42 virtual const char *getClassName() const 43 { 44 return "LIC"; 45 } 46 47 virtual void setClippingPlanes(vtkPlaneCollection *planes); 45 48 46 49 void selectVolumeSlice(Axis axis, double ratio); … … 50 53 vtkLookupTable *getLookupTable(); 51 54 52 void setOpacity(double opacity); 55 private: 56 virtual void initProp(); 57 virtual void update(); 53 58 54 double getOpacity();55 56 void setVisibility(bool state);57 58 bool getVisibility();59 60 void setEdgeVisibility(bool state);61 62 void setEdgeColor(float color[3]);63 64 void setEdgeWidth(float edgeWidth);65 66 void setClippingPlanes(vtkPlaneCollection *planes);67 68 void setLighting(bool state);69 70 private:71 void initProp();72 void update();73 74 DataSet *_dataSet;75 76 float _edgeColor[3];77 float _edgeWidth;78 double _opacity;79 bool _lighting;80 59 Axis _sliceAxis; 81 60 82 61 vtkSmartPointer<vtkLookupTable> _lut; 83 vtkSmartPointer<vtkActor> _prop;84 62 vtkSmartPointer<vtkExtractVOI> _volumeSlicer; 85 63 vtkSmartPointer<vtkProbeFilter> _probeFilter; -
trunk/packages/vizservers/vtkvis/RpMolecule.cpp
r2320 r2328 26 26 27 27 Molecule::Molecule() : 28 _dataSet(NULL), 29 _edgeWidth(1.0), 30 _opacity(1.0), 31 _lighting(true), 28 VtkGraphicsObject(), 32 29 _atomScaling(NO_ATOM_SCALING) 33 30 { 34 _edgeColor[0] = 0.0;35 _edgeColor[1] = 0.0;36 _edgeColor[2] = 0.0;37 31 } 38 32 … … 45 39 TRACE("Deleting Molecule with NULL DataSet"); 46 40 #endif 47 }48 49 /**50 * \brief Get the VTK Prop for the Molecule51 */52 vtkProp *Molecule::getProp()53 {54 return _props;55 41 } 56 42 … … 80 66 _bondProp->GetProperty()->LightingOff(); 81 67 } 82 if (_props == NULL) { 83 _props = vtkSmartPointer<vtkPropAssembly>::New(); 84 } 85 } 86 87 /** 88 * \brief Specify input DataSet (PolyData) 89 * 90 * The DataSet must be a PolyData object. Vertices are used for atom 91 * positions and Lines are used to draw bonds. A scalar field and 92 * color map may be supplied to color the atoms and bonds. 93 */ 94 void Molecule::setDataSet(DataSet *dataSet) 95 { 96 if (_dataSet != dataSet) { 97 _dataSet = dataSet; 98 update(); 99 } 100 } 101 102 /** 103 * \brief Returns the DataSet this Molecule renders 104 */ 105 DataSet *Molecule::getDataSet() 106 { 107 return _dataSet; 68 if (_prop == NULL) { 69 _prop = vtkSmartPointer<vtkAssembly>::New(); 70 } 108 71 } 109 72 … … 194 157 _bondMapper->SetInputConnection(tuber->GetOutputPort()); 195 158 _bondProp->SetMapper(_bondMapper); 196 _props->AddPart(_bondProp);159 getAssembly()->AddPart(_bondProp); 197 160 } 198 161 if (pd->GetNumberOfVerts() > 0) { … … 217 180 _atomMapper->SetInputConnection(_glypher->GetOutputPort()); 218 181 _atomProp->SetMapper(_atomMapper); 219 _props->AddPart(_atomProp);182 getAssembly()->AddPart(_atomProp); 220 183 } 221 184 } else { … … 259 222 260 223 /** 261 * \brief Turn on/off rendering of this Molecule262 */263 void Molecule::setVisibility(bool state)264 {265 if (_props != NULL) {266 _props->SetVisibility((state ? 1 : 0));267 }268 }269 270 /**271 224 * \brief Turn on/off rendering of the atoms 272 225 */ … … 286 239 _bondProp->SetVisibility((state ? 1 : 0)); 287 240 } 288 }289 290 /**291 * \brief Get visibility state of the Molecule292 *293 * \return Is mesh visible?294 */295 bool Molecule::getVisibility()296 {297 if (_props == NULL) {298 return false;299 } else {300 return (_props->GetVisibility() != 0);301 }302 }303 304 /**305 * \brief Set opacity used to render the Molecule306 */307 void Molecule::setOpacity(double opacity)308 {309 _opacity = opacity;310 if (_atomProp != NULL)311 _atomProp->GetProperty()->SetOpacity(opacity);312 if (_bondProp != NULL)313 _bondProp->GetProperty()->SetOpacity(opacity);314 }315 316 /**317 * \brief Switch between wireframe and surface representations318 */319 void Molecule::setWireframe(bool state)320 {321 if (_atomProp != NULL) {322 if (state) {323 _atomProp->GetProperty()->SetRepresentationToWireframe();324 _atomProp->GetProperty()->LightingOff();325 } else {326 _atomProp->GetProperty()->SetRepresentationToSurface();327 _atomProp->GetProperty()->SetLighting((_lighting ? 1 : 0));328 }329 }330 if (_bondProp != NULL) {331 if (state) {332 _bondProp->GetProperty()->SetRepresentationToWireframe();333 _bondProp->GetProperty()->LightingOff();334 } else {335 _bondProp->GetProperty()->SetRepresentationToSurface();336 _bondProp->GetProperty()->SetLighting((_lighting ? 1 : 0));337 }338 }339 }340 341 /**342 * \brief Turn on/off rendering of mesh edges343 */344 void Molecule::setEdgeVisibility(bool state)345 {346 if (_atomProp != NULL) {347 _atomProp->GetProperty()->SetEdgeVisibility((state ? 1 : 0));348 }349 if (_bondProp != NULL) {350 _bondProp->GetProperty()->SetEdgeVisibility((state ? 1 : 0));351 }352 }353 354 /**355 * \brief Set RGB color of polygon edges356 */357 void Molecule::setEdgeColor(float color[3])358 {359 _edgeColor[0] = color[0];360 _edgeColor[1] = color[1];361 _edgeColor[2] = color[2];362 if (_atomProp != NULL)363 _atomProp->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]);364 if (_bondProp != NULL)365 _bondProp->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]);366 }367 368 /**369 * \brief Set pixel width of polygon edges (may be a no-op)370 */371 void Molecule::setEdgeWidth(float edgeWidth)372 {373 _edgeWidth = edgeWidth;374 if (_atomProp != NULL)375 _atomProp->GetProperty()->SetLineWidth(_edgeWidth);376 if (_bondProp != NULL)377 _bondProp->GetProperty()->SetLineWidth(_edgeWidth);378 241 } 379 242 … … 394 257 395 258 /** 396 * \brief Turn on/off lighting of this object 397 */ 398 void Molecule::setLighting(bool state) 399 { 400 _lighting = state; 401 if (_atomProp != NULL) 402 _atomProp->GetProperty()->SetLighting((state ? 1 : 0)); 403 if (_bondProp != NULL) 404 _bondProp->GetProperty()->SetLighting((state ? 1 : 0)); 405 } 406 259 * \brief Set the radius type used for scaling atoms 260 */ 407 261 void Molecule::setAtomScaling(AtomScaling state) 408 262 { -
trunk/packages/vizservers/vtkvis/RpMolecule.h
r2320 r2328 13 13 #include <vtkPolyDataMapper.h> 14 14 #include <vtkActor.h> 15 #include <vtk PropAssembly.h>15 #include <vtkAssembly.h> 16 16 #include <vtkGlyph3D.h> 17 17 18 18 #include "ColorMap.h" 19 #include "RpVtk DataSet.h"19 #include "RpVtkGraphicsObject.h" 20 20 21 21 namespace Rappture { … … 33 33 * "element," it will be color-mapped as a standard scalar field. 34 34 */ 35 class Molecule {35 class Molecule : public VtkGraphicsObject { 36 36 public: 37 37 enum AtomScaling { … … 45 45 virtual ~Molecule(); 46 46 47 void setDataSet(DataSet *dataset); 47 virtual const char *getClassName() const 48 { 49 return "Molecule"; 50 } 48 51 49 DataSet *getDataSet(); 50 51 vtkProp *getProp(); 52 virtual void setClippingPlanes(vtkPlaneCollection *planes); 52 53 53 54 void setLookupTable(vtkLookupTable *lut); … … 61 62 void setBondVisibility(bool state); 62 63 63 void setVisibility(bool state);64 65 bool getVisibility();66 67 void setOpacity(double opacity);68 69 void setWireframe(bool state);70 71 void setEdgeVisibility(bool state);72 73 void setEdgeColor(float color[3]);74 75 void setEdgeWidth(float edgeWidth);76 77 void setClippingPlanes(vtkPlaneCollection *planes);78 79 void setLighting(bool state);80 81 64 static ColorMap *createElementColorMap(); 82 65 83 66 private: 84 v oid initProp();85 v oid update();67 virtual void initProp(); 68 virtual void update(); 86 69 87 70 static void addRadiusArray(vtkDataSet *dataSet, AtomScaling scaling); 88 71 89 DataSet *_dataSet;90 91 float _edgeColor[3];92 float _edgeWidth;93 double _opacity;94 bool _lighting;95 72 AtomScaling _atomScaling; 96 73 97 74 vtkSmartPointer<vtkLookupTable> _lut; 98 vtkSmartPointer<vtkPropAssembly> _props;99 75 vtkSmartPointer<vtkActor> _atomProp; 100 76 vtkSmartPointer<vtkActor> _bondProp; -
trunk/packages/vizservers/vtkvis/RpPolyData.cpp
r2320 r2328 24 24 25 25 PolyData::PolyData() : 26 _dataSet(NULL), 27 _edgeWidth(1.0), 28 _opacity(1.0), 29 _lighting(true) 26 VtkGraphicsObject() 30 27 { 31 _color[0] = 0.0; 32 _color[1] = 0.0; 33 _color[2] = 1.0; 34 _edgeColor[0] = 0.0; 35 _edgeColor[1] = 0.0; 36 _edgeColor[2] = 0.0; 28 _color[0] = 0.0f; 29 _color[1] = 0.0f; 30 _color[2] = 1.0f; 37 31 } 38 32 … … 48 42 49 43 /** 50 * \brief Get the VTK Prop for the mesh51 */52 vtkProp *PolyData::getProp()53 {54 return _pdActor;55 }56 57 /**58 44 * \brief Create and initialize a VTK Prop to render a mesh 59 45 */ 60 46 void PolyData::initProp() 61 47 { 62 if (_pdActor == NULL) { 63 _pdActor = vtkSmartPointer<vtkActor>::New(); 64 _pdActor->GetProperty()->EdgeVisibilityOn(); 65 _pdActor->GetProperty()->SetColor(_color[0], _color[1], _color[2]); 66 _pdActor->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]); 67 _pdActor->GetProperty()->SetLineWidth(_edgeWidth); 68 _pdActor->GetProperty()->SetOpacity(_opacity); 69 _pdActor->GetProperty()->SetAmbient(.2); 48 if (_prop == NULL) { 49 _prop = vtkSmartPointer<vtkActor>::New(); 50 vtkProperty *property = getActor()->GetProperty(); 51 property->EdgeVisibilityOn(); 52 property->SetColor(_color[0], _color[1], _color[2]); 53 property->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]); 54 property->SetLineWidth(_edgeWidth); 55 property->SetOpacity(_opacity); 56 property->SetAmbient(.2); 70 57 if (!_lighting) 71 _pdActor->GetProperty()->LightingOff();58 property->LightingOff(); 72 59 } 73 }74 75 /**76 * \brief Specify input DataSet (PolyData)77 *78 * The DataSet must be a PolyData object79 */80 void PolyData::setDataSet(DataSet *dataSet)81 {82 if (_dataSet != dataSet) {83 _dataSet = dataSet;84 update();85 }86 }87 88 /**89 * \brief Returns the DataSet this PolyData renders90 */91 DataSet *PolyData::getDataSet()92 {93 return _dataSet;94 60 } 95 61 … … 157 123 158 124 initProp(); 159 _pdActor->SetMapper(_pdMapper);125 getActor()->SetMapper(_pdMapper); 160 126 _pdMapper->Update(); 161 }162 163 /**164 * \brief Turn on/off rendering of this mesh165 */166 void PolyData::setVisibility(bool state)167 {168 if (_pdActor != NULL) {169 _pdActor->SetVisibility((state ? 1 : 0));170 }171 }172 173 /**174 * \brief Get visibility state of the mesh175 *176 * \return Is mesh visible?177 */178 bool PolyData::getVisibility()179 {180 if (_pdActor == NULL) {181 return false;182 } else {183 return (_pdActor->GetVisibility() != 0);184 }185 }186 187 /**188 * \brief Set opacity used to render the mesh189 */190 void PolyData::setOpacity(double opacity)191 {192 _opacity = opacity;193 if (_pdActor != NULL)194 _pdActor->GetProperty()->SetOpacity(opacity);195 }196 197 /**198 * \brief Switch between wireframe and surface representations199 */200 void PolyData::setWireframe(bool state)201 {202 if (_pdActor != NULL) {203 if (state) {204 _pdActor->GetProperty()->SetRepresentationToWireframe();205 _pdActor->GetProperty()->LightingOff();206 } else {207 _pdActor->GetProperty()->SetRepresentationToSurface();208 _pdActor->GetProperty()->SetLighting((_lighting ? 1 : 0));209 }210 }211 }212 213 /**214 * \brief Set RGB color of polygon faces215 */216 void PolyData::setColor(float color[3])217 {218 _color[0] = color[0];219 _color[1] = color[1];220 _color[2] = color[2];221 if (_pdActor != NULL)222 _pdActor->GetProperty()->SetColor(_color[0], _color[1], _color[2]);223 }224 225 /**226 * \brief Turn on/off rendering of mesh edges227 */228 void PolyData::setEdgeVisibility(bool state)229 {230 if (_pdActor != NULL) {231 _pdActor->GetProperty()->SetEdgeVisibility((state ? 1 : 0));232 }233 }234 235 /**236 * \brief Set RGB color of polygon edges237 */238 void PolyData::setEdgeColor(float color[3])239 {240 _edgeColor[0] = color[0];241 _edgeColor[1] = color[1];242 _edgeColor[2] = color[2];243 if (_pdActor != NULL)244 _pdActor->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]);245 }246 247 /**248 * \brief Set pixel width of polygon edges (may be a no-op)249 */250 void PolyData::setEdgeWidth(float edgeWidth)251 {252 _edgeWidth = edgeWidth;253 if (_pdActor != NULL)254 _pdActor->GetProperty()->SetLineWidth(_edgeWidth);255 127 } 256 128 … … 267 139 } 268 140 269 /**270 * \brief Turn on/off lighting of this object271 */272 void PolyData::setLighting(bool state)273 {274 _lighting = state;275 if (_pdActor != NULL)276 _pdActor->GetProperty()->SetLighting((state ? 1 : 0));277 } -
trunk/packages/vizservers/vtkvis/RpPolyData.h
r2320 r2328 13 13 #include <vtkActor.h> 14 14 15 #include "RpVtkGraphicsObject.h" 15 16 #include "RpVtkDataSet.h" 16 17 … … 20 21 /** 21 22 * \brief VTK Mesh (Polygon data) 23 * 24 * The DataSet must be a PolyData object 22 25 */ 23 class PolyData {26 class PolyData : public VtkGraphicsObject { 24 27 public: 25 28 PolyData(); 26 29 virtual ~PolyData(); 27 30 28 void setDataSet(DataSet *dataset); 31 virtual const char *getClassName() const 32 { 33 return "PolyData"; 34 } 29 35 30 DataSet *getDataSet(); 31 32 vtkProp *getProp(); 33 34 void setVisibility(bool state); 35 36 bool getVisibility(); 37 38 void setOpacity(double opacity); 39 40 void setWireframe(bool state); 41 42 void setColor(float color[3]); 43 44 void setEdgeVisibility(bool state); 45 46 void setEdgeColor(float color[3]); 47 48 void setEdgeWidth(float edgeWidth); 49 50 void setClippingPlanes(vtkPlaneCollection *planes); 51 52 void setLighting(bool state); 36 virtual void setClippingPlanes(vtkPlaneCollection *planes); 53 37 54 38 private: 55 v oid initProp();56 v oid update();39 virtual void initProp(); 40 virtual void update(); 57 41 58 DataSet *_dataSet;59 60 float _color[3];61 float _edgeColor[3];62 float _edgeWidth;63 double _opacity;64 bool _lighting;65 42 vtkSmartPointer<vtkPolyDataMapper> _pdMapper; 66 vtkSmartPointer<vtkActor> _pdActor;67 43 }; 68 44 -
trunk/packages/vizservers/vtkvis/RpPseudoColor.cpp
r2320 r2328 29 29 30 30 PseudoColor::PseudoColor() : 31 _dataSet(NULL), 32 _edgeWidth(1.0), 33 _opacity(1.0), 34 _lighting(true) 35 { 36 _edgeColor[0] = 0.0; 37 _edgeColor[1] = 0.0; 38 _edgeColor[2] = 0.0; 31 VtkGraphicsObject() 32 { 39 33 } 40 34 … … 50 44 51 45 /** 52 * \brief Specify input DataSet with scalars to colormap 53 * 54 * Currently the DataSet must be image data (2D uniform grid) 55 */ 56 void PseudoColor::setDataSet(DataSet *dataSet) 57 { 58 if (_dataSet != dataSet) { 59 _dataSet = dataSet; 60 update(); 61 } 62 } 63 64 /** 65 * \brief Returns the DataSet this PseudoColor renders 66 */ 67 DataSet *PseudoColor::getDataSet() 68 { 69 return _dataSet; 46 * \brief Create and initialize a VTK Prop to render the colormapped dataset 47 */ 48 void PseudoColor::initProp() 49 { 50 if (_prop == NULL) { 51 _prop = vtkSmartPointer<vtkActor>::New(); 52 vtkProperty *property = getActor()->GetProperty(); 53 property->SetOpacity(_opacity); 54 property->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]); 55 property->SetLineWidth(_edgeWidth); 56 property->EdgeVisibilityOff(); 57 property->SetAmbient(.2); 58 if (!_lighting) 59 property->LightingOff(); 60 } 70 61 } 71 62 … … 170 161 171 162 initProp(); 172 _dsActor->SetMapper(_dsMapper);163 getActor()->SetMapper(_dsMapper); 173 164 _dsMapper->Update(); 174 }175 176 /**177 * \brief Get the VTK Prop for the colormapped dataset178 */179 vtkProp *PseudoColor::getProp()180 {181 return _dsActor;182 }183 184 /**185 * \brief Create and initialize a VTK Prop to render the colormapped dataset186 */187 void PseudoColor::initProp()188 {189 if (_dsActor == NULL) {190 _dsActor = vtkSmartPointer<vtkActor>::New();191 _dsActor->GetProperty()->SetOpacity(_opacity);192 _dsActor->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]);193 _dsActor->GetProperty()->SetLineWidth(_edgeWidth);194 _dsActor->GetProperty()->EdgeVisibilityOff();195 _dsActor->GetProperty()->SetAmbient(.2);196 if (!_lighting)197 _dsActor->GetProperty()->LightingOff();198 }199 165 } 200 166 … … 225 191 226 192 /** 227 * \brief Turn on/off rendering of this colormapped dataset228 */229 void PseudoColor::setVisibility(bool state)230 {231 if (_dsActor != NULL) {232 _dsActor->SetVisibility((state ? 1 : 0));233 }234 }235 236 /**237 * \brief Get visibility state of the colormapped dataset238 *239 * \return Is PseudoColor visible?240 */241 bool PseudoColor::getVisibility()242 {243 if (_dsActor == NULL) {244 return false;245 } else {246 return (_dsActor->GetVisibility() != 0);247 }248 }249 250 /**251 * \brief Set opacity used to render the colormapped dataset252 */253 void PseudoColor::setOpacity(double opacity)254 {255 _opacity = opacity;256 if (_dsActor != NULL)257 _dsActor->GetProperty()->SetOpacity(opacity);258 }259 260 /**261 * \brief Switch between wireframe and surface representations262 */263 void PseudoColor::setWireframe(bool state)264 {265 if (_dsActor != NULL) {266 if (state) {267 _dsActor->GetProperty()->SetRepresentationToWireframe();268 _dsActor->GetProperty()->LightingOff();269 } else {270 _dsActor->GetProperty()->SetRepresentationToSurface();271 _dsActor->GetProperty()->SetLighting((_lighting ? 1 : 0));272 }273 }274 }275 276 /**277 * \brief Turn on/off rendering of mesh edges278 */279 void PseudoColor::setEdgeVisibility(bool state)280 {281 if (_dsActor != NULL) {282 _dsActor->GetProperty()->SetEdgeVisibility((state ? 1 : 0));283 }284 }285 286 /**287 * \brief Set RGB color of polygon edges288 */289 void PseudoColor::setEdgeColor(float color[3])290 {291 _edgeColor[0] = color[0];292 _edgeColor[1] = color[1];293 _edgeColor[2] = color[2];294 if (_dsActor != NULL)295 _dsActor->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]);296 }297 298 /**299 * \brief Set pixel width of polygon edges (may be a no-op)300 */301 void PseudoColor::setEdgeWidth(float edgeWidth)302 {303 _edgeWidth = edgeWidth;304 if (_dsActor != NULL)305 _dsActor->GetProperty()->SetLineWidth(_edgeWidth);306 }307 308 /**309 193 * \brief Set a group of world coordinate planes to clip rendering 310 194 * … … 317 201 } 318 202 } 319 320 /**321 * \brief Turn on/off lighting of this object322 */323 void PseudoColor::setLighting(bool state)324 {325 _lighting = state;326 if (_dsActor != NULL)327 _dsActor->GetProperty()->SetLighting((state ? 1 : 0));328 } -
trunk/packages/vizservers/vtkvis/RpPseudoColor.h
r2320 r2328 15 15 #include <vtkPlaneCollection.h> 16 16 17 #include "RpVtkGraphicsObject.h" 17 18 #include "RpVtkDataSet.h" 18 19 … … 22 23 /** 23 24 * \brief Color-mapped plot of data set 25 * 26 * Currently the DataSet must be image data (2D uniform grid) 24 27 */ 25 class PseudoColor {28 class PseudoColor : public VtkGraphicsObject { 26 29 public: 27 30 PseudoColor(); 28 31 virtual ~PseudoColor(); 29 32 30 void setDataSet(DataSet *dataset); 33 virtual const char *getClassName() const 34 { 35 return "PseudoColor"; 36 } 31 37 32 DataSet *getDataSet(); 33 34 vtkProp *getProp(); 38 virtual void setClippingPlanes(vtkPlaneCollection *planes); 35 39 36 40 void setLookupTable(vtkLookupTable *lut); … … 38 42 vtkLookupTable *getLookupTable(); 39 43 40 void setVisibility(bool state); 44 private: 45 virtual void initProp(); 46 virtual void update(); 41 47 42 bool getVisibility();43 44 void setOpacity(double opacity);45 46 void setWireframe(bool state);47 48 void setEdgeVisibility(bool state);49 50 void setEdgeColor(float color[3]);51 52 void setEdgeWidth(float edgeWidth);53 54 void setClippingPlanes(vtkPlaneCollection *planes);55 56 void setLighting(bool state);57 58 private:59 void initProp();60 void update();61 62 DataSet * _dataSet;63 64 float _edgeColor[3];65 float _edgeWidth;66 double _opacity;67 bool _lighting;68 48 vtkSmartPointer<vtkLookupTable> _lut; 69 49 vtkSmartPointer<vtkDataSetMapper> _dsMapper; 70 vtkSmartPointer<vtkActor> _dsActor;71 50 }; 72 51 -
trunk/packages/vizservers/vtkvis/RpStreamlines.cpp
r2319 r2328 28 28 29 29 Streamlines::Streamlines() : 30 _dataSet(NULL),30 VtkGraphicsObject(), 31 31 _lineType(LINES), 32 _edgeWidth(1.0f),33 _opacity(1.0),34 _lighting(false),35 32 _seedVisible(true) 36 33 { 37 _edgeColor[0] = 0.0f;38 _edgeColor[1] = 0.0f;39 _edgeColor[2] = 0.0f;40 34 _seedColor[0] = 1.0f; 41 35 _seedColor[1] = 1.0f; … … 48 42 49 43 /** 50 * \brief Get the VTK Prop for the Streamlines51 */52 vtkProp *Streamlines::getProp()53 {54 return _props;55 }56 57 /**58 44 * \brief Create and initialize a VTK Prop to render Streamlines 59 45 */ 60 46 void Streamlines::initProp() 61 47 { 62 if (_ prop== NULL) {63 _ prop= vtkSmartPointer<vtkActor>::New();64 _ prop->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]);65 _ prop->GetProperty()->SetLineWidth(_edgeWidth);66 _ prop->GetProperty()->SetOpacity(_opacity);67 _ prop->GetProperty()->SetAmbient(.2);48 if (_linesActor == NULL) { 49 _linesActor = vtkSmartPointer<vtkActor>::New(); 50 _linesActor->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]); 51 _linesActor->GetProperty()->SetLineWidth(_edgeWidth); 52 _linesActor->GetProperty()->SetOpacity(_opacity); 53 _linesActor->GetProperty()->SetAmbient(.2); 68 54 if (!_lighting) 69 _ prop->GetProperty()->LightingOff();55 _linesActor->GetProperty()->LightingOff(); 70 56 switch (_lineType) { 71 57 case LINES: 72 _ prop->GetProperty()->SetRepresentationToWireframe();73 _ prop->GetProperty()->EdgeVisibilityOff();58 _linesActor->GetProperty()->SetRepresentationToWireframe(); 59 _linesActor->GetProperty()->EdgeVisibilityOff(); 74 60 break; 75 61 case TUBES: 76 _ prop->GetProperty()->SetRepresentationToSurface();77 _ prop->GetProperty()->EdgeVisibilityOff();62 _linesActor->GetProperty()->SetRepresentationToSurface(); 63 _linesActor->GetProperty()->EdgeVisibilityOff(); 78 64 break; 79 65 case RIBBONS: 80 _ prop->GetProperty()->SetRepresentationToSurface();81 _ prop->GetProperty()->EdgeVisibilityOff();66 _linesActor->GetProperty()->SetRepresentationToSurface(); 67 _linesActor->GetProperty()->EdgeVisibilityOff(); 82 68 break; 83 69 default: … … 94 80 _seedActor->GetProperty()->LightingOff(); 95 81 } 96 if (_props == NULL) { 97 _props = vtkSmartPointer<vtkPropAssembly>::New(); 98 _props->AddPart(_prop); 99 _props->AddPart(_seedActor); 100 } 101 } 102 103 /** 104 * \brief Specify input DataSet 105 * 106 * The DataSet must contain vectors 107 */ 108 void Streamlines::setDataSet(DataSet *dataSet) 109 { 110 if (_dataSet != dataSet) { 111 _dataSet = dataSet; 112 update(); 113 } 114 } 115 116 /** 117 * \brief Returns the DataSet this Streamlines renders 118 */ 119 DataSet *Streamlines::getDataSet() 120 { 121 return _dataSet; 82 if (_prop == NULL) { 83 _prop = vtkSmartPointer<vtkAssembly>::New(); 84 getAssembly()->AddPart(_linesActor); 85 getAssembly()->AddPart(_seedActor); 86 } 122 87 } 123 88 … … 284 249 _pdMapper->SetLookupTable(_lut); 285 250 286 _ prop->SetMapper(_pdMapper);251 _linesActor->SetMapper(_pdMapper); 287 252 _pdMapper->Update(); 288 253 _seedMapper->Update(); … … 442 407 _pdMapper->SetInputConnection(_streamTracer->GetOutputPort()); 443 408 _lineFilter = NULL; 444 _ prop->GetProperty()->SetRepresentationToWireframe();445 _ prop->GetProperty()->LightingOff();409 _linesActor->GetProperty()->SetRepresentationToWireframe(); 410 _linesActor->GetProperty()->LightingOff(); 446 411 } 447 412 } … … 468 433 tubeFilter->SetRadius(radius); 469 434 _pdMapper->SetInputConnection(_lineFilter->GetOutputPort()); 470 _ prop->GetProperty()->SetRepresentationToSurface();471 _ prop->GetProperty()->LightingOn();435 _linesActor->GetProperty()->SetRepresentationToSurface(); 436 _linesActor->GetProperty()->LightingOn(); 472 437 } 473 438 } … … 493 458 ribbonFilter->UseDefaultNormalOn(); 494 459 _pdMapper->SetInputConnection(_lineFilter->GetOutputPort()); 495 _ prop->GetProperty()->SetRepresentationToSurface();496 _ prop->GetProperty()->LightingOn();460 _linesActor->GetProperty()->SetRepresentationToSurface(); 461 _linesActor->GetProperty()->LightingOn(); 497 462 } 498 463 } … … 523 488 524 489 /** 490 * \brief Turn on/off lighting of this object 491 */ 492 void Streamlines::setLighting(bool state) 493 { 494 _lighting = state; 495 if (_linesActor != NULL) 496 _linesActor->GetProperty()->SetLighting((state ? 1 : 0)); 497 } 498 499 /** 525 500 * \brief Turn on/off rendering of this Streamlines 526 501 */ 527 502 void Streamlines::setVisibility(bool state) 528 503 { 529 if (_ prop!= NULL) {530 _ prop->SetVisibility((state ? 1 : 0));504 if (_linesActor != NULL) { 505 _linesActor->SetVisibility((state ? 1 : 0)); 531 506 } 532 507 if (_seedActor != NULL) { … … 556 531 bool Streamlines::getVisibility() 557 532 { 558 if (_ prop== NULL) {533 if (_linesActor == NULL) { 559 534 return false; 560 535 } else { 561 return (_prop->GetVisibility() != 0); 562 } 563 } 564 565 /** 566 * \brief Set opacity used to render the Streamlines 567 */ 568 void Streamlines::setOpacity(double opacity) 569 { 570 _opacity = opacity; 571 if (_prop != NULL) { 572 _prop->GetProperty()->SetOpacity(opacity); 573 } 574 if (_seedActor != NULL) { 575 _seedActor->GetProperty()->SetOpacity(opacity); 576 } 577 } 578 579 /** 580 * \brief Get opacity used to render the Streamlines 581 */ 582 double Streamlines::getOpacity() 583 { 584 return _opacity; 536 return (_linesActor->GetVisibility() != 0); 537 } 585 538 } 586 539 … … 590 543 void Streamlines::setEdgeVisibility(bool state) 591 544 { 592 if (_ prop!= NULL) {593 _ prop->GetProperty()->SetEdgeVisibility((state ? 1 : 0));545 if (_linesActor != NULL) { 546 _linesActor->GetProperty()->SetEdgeVisibility((state ? 1 : 0)); 594 547 } 595 548 } … … 603 556 _edgeColor[1] = color[1]; 604 557 _edgeColor[2] = color[2]; 605 if (_ prop!= NULL)606 _ prop->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]);558 if (_linesActor != NULL) 559 _linesActor->GetProperty()->SetEdgeColor(_edgeColor[0], _edgeColor[1], _edgeColor[2]); 607 560 } 608 561 … … 625 578 { 626 579 _edgeWidth = edgeWidth; 627 if (_ prop!= NULL)628 _ prop->GetProperty()->SetLineWidth(_edgeWidth);580 if (_linesActor != NULL) 581 _linesActor->GetProperty()->SetLineWidth(_edgeWidth); 629 582 } 630 583 … … 643 596 } 644 597 } 645 646 /**647 * \brief Turn on/off lighting of this object648 */649 void Streamlines::setLighting(bool state)650 {651 _lighting = state;652 if (_prop != NULL)653 _prop->GetProperty()->SetLighting((state ? 1 : 0));654 } -
trunk/packages/vizservers/vtkvis/RpStreamlines.h
r2318 r2328 16 16 #include <vtkPolyDataMapper.h> 17 17 #include <vtkLookupTable.h> 18 #include <vtk PropAssembly.h>18 #include <vtkAssembly.h> 19 19 20 #include "RpVtk DataSet.h"20 #include "RpVtkGraphicsObject.h" 21 21 22 22 namespace Rappture { … … 25 25 /** 26 26 * \brief Streamline visualization of vector fields 27 * 28 * The DataSet must contain vectors 27 29 */ 28 class Streamlines {30 class Streamlines : public VtkGraphicsObject { 29 31 public: 30 32 enum LineType { … … 37 39 virtual ~Streamlines(); 38 40 39 void setDataSet(DataSet *dataset); 41 virtual const char *getClassName() const 42 { 43 return "Streamlines"; 44 } 40 45 41 DataSet *getDataSet(); 46 virtual void setLighting(bool state); 47 48 virtual void setVisibility(bool state); 42 49 43 vtkProp *getProp(); 50 virtual bool getVisibility(); 51 52 virtual void setEdgeVisibility(bool state); 53 54 virtual void setEdgeColor(float color[3]); 55 56 virtual void setEdgeWidth(float edgeWidth); 57 58 virtual void setClippingPlanes(vtkPlaneCollection *planes); 44 59 45 60 void setSeedToRandomPoints(int numPoints); … … 62 77 vtkLookupTable *getLookupTable(); 63 78 64 void setOpacity(double opacity);65 66 double getOpacity();67 68 void setVisibility(bool state);69 70 79 void setSeedVisibility(bool state); 71 72 bool getVisibility();73 74 void setEdgeVisibility(bool state);75 76 void setEdgeColor(float color[3]);77 78 void setEdgeWidth(float edgeWidth);79 80 80 81 void setSeedColor(float color[3]); 81 82 82 void setClippingPlanes(vtkPlaneCollection *planes);83 84 void setLighting(bool state);85 86 83 private: 87 v oid initProp();88 v oid update();84 virtual void initProp(); 85 virtual void update(); 89 86 90 87 static void getRandomPoint(double pt[3], const double bounds[6]); 91 88 static void getRandomCellPt(vtkDataSet *ds, double pt[3]); 92 89 93 DataSet *_dataSet;94 95 90 LineType _lineType; 96 float _edgeColor[3];97 float _edgeWidth;98 91 float _seedColor[3]; 99 double _opacity;100 bool _lighting;101 92 bool _seedVisible; 102 93 103 94 vtkSmartPointer<vtkLookupTable> _lut; 104 vtkSmartPointer<vtkActor> _ prop;95 vtkSmartPointer<vtkActor> _linesActor; 105 96 vtkSmartPointer<vtkActor> _seedActor; 106 vtkSmartPointer<vtkPropAssembly> _props;107 97 vtkSmartPointer<vtkStreamTracer> _streamTracer; 108 98 vtkSmartPointer<vtkPolyDataAlgorithm> _lineFilter; -
trunk/packages/vizservers/vtkvis/RpVolume.cpp
r2320 r2328 27 27 28 28 Volume::Volume() : 29 _dataSet(NULL), 30 _opacity(1.0), 29 VtkGraphicsObject(), 31 30 _colorMap(NULL) 32 31 { … … 44 43 45 44 /** 46 * \brief Specify input DataSet with scalars 47 * 48 * Currently the DataSet must be image data (3D uniform grid), 49 * or an UnstructuredGrid 45 * \brief Create and initialize a VTK Prop to render the Volume 50 46 */ 51 void Volume:: setDataSet(DataSet *dataSet)47 void Volume::initProp() 52 48 { 53 if (_ dataSet != dataSet) {54 _ dataSet = dataSet;55 update();49 if (_prop == NULL) { 50 _prop = vtkSmartPointer<vtkVolume>::New(); 51 getVolume()->GetProperty()->SetInterpolationTypeToLinear(); 56 52 } 57 }58 59 /**60 * \brief Returns the DataSet this Volume renders61 */62 DataSet *Volume::getDataSet()63 {64 return _dataSet;65 53 } 66 54 … … 129 117 } 130 118 131 _volumeProp->GetProperty()->SetColor(_colorMap->getColorTransferFunction(dataRange)); 132 _volumeProp->GetProperty()->SetScalarOpacity(_colorMap->getOpacityTransferFunction(dataRange)); 119 vtkVolumeProperty *volProperty = getVolume()->GetProperty(); 120 volProperty->SetColor(_colorMap->getColorTransferFunction(dataRange)); 121 volProperty->SetScalarOpacity(_colorMap->getOpacityTransferFunction(dataRange)); 133 122 134 _volumeProp->SetMapper(_volumeMapper);123 getVolume()->SetMapper(_volumeMapper); 135 124 _volumeMapper->Update(); 136 }137 138 /**139 * \brief Get the VTK Prop for the Volume140 */141 vtkProp *Volume::getProp()142 {143 return _volumeProp;144 }145 146 /**147 * \brief Create and initialize a VTK Prop to render the Volume148 */149 void Volume::initProp()150 {151 if (_volumeProp == NULL) {152 _volumeProp = vtkSmartPointer<vtkVolume>::New();153 _volumeProp->GetProperty()->SetInterpolationTypeToLinear();154 }155 125 } 156 126 … … 161 131 { 162 132 _colorMap = cmap; 163 if ( _volumeProp!= NULL) {133 if (getVolume() != NULL) { 164 134 double dataRange[2]; 165 135 _dataSet->getDataRange(dataRange); 166 _volumeProp->GetProperty()->SetColor(_colorMap->getColorTransferFunction(dataRange));167 _volumeProp->GetProperty()->SetScalarOpacity(_colorMap->getOpacityTransferFunction(dataRange));136 getVolume()->GetProperty()->SetColor(_colorMap->getColorTransferFunction(dataRange)); 137 getVolume()->GetProperty()->SetScalarOpacity(_colorMap->getOpacityTransferFunction(dataRange)); 168 138 } 169 139 } … … 176 146 { 177 147 _colorMap = cmap; 178 if ( _volumeProp!= NULL) {179 _volumeProp->GetProperty()->SetColor(_colorMap->getColorTransferFunction(dataRange));180 _volumeProp->GetProperty()->SetScalarOpacity(_colorMap->getOpacityTransferFunction(dataRange));148 if (getVolume() != NULL) { 149 getVolume()->GetProperty()->SetColor(_colorMap->getColorTransferFunction(dataRange)); 150 getVolume()->GetProperty()->SetScalarOpacity(_colorMap->getOpacityTransferFunction(dataRange)); 181 151 } 182 152 } … … 199 169 // across the different mappers/algorithms. This only works with the 200 170 // 3D texture mapper, not the GPU raycast mapper 201 if ( _volumeProp!= NULL) {171 if (getVolume() != NULL) { 202 172 if (opacity < 1.0e-6) 203 173 opacity = 1.0e-6; 204 _volumeProp->GetProperty()->SetScalarOpacityUnitDistance(1.0/opacity); 205 } 206 } 207 208 /** 209 * \brief Turn on/off rendering of this Volume 210 */ 211 void Volume::setVisibility(bool state) 212 { 213 if (_volumeProp != NULL) { 214 _volumeProp->SetVisibility((state ? 1 : 0)); 215 } 216 } 217 218 /** 219 * \brief Get visibility state of the Volume 220 * 221 * \return Is PseudoColor visible? 222 */ 223 bool Volume::getVisibility() 224 { 225 if (_volumeProp == NULL) { 226 return false; 227 } else { 228 return (_volumeProp->GetVisibility() != 0); 174 getVolume()->GetProperty()->SetScalarOpacityUnitDistance(1.0/opacity); 229 175 } 230 176 } … … 241 187 } 242 188 } 243 244 /**245 * \brief Set the ambient lighting/shading coefficient246 */247 void Volume::setAmbient(double coeff)248 {249 if (_volumeProp != NULL) {250 _volumeProp->GetProperty()->SetAmbient(coeff);251 }252 }253 254 /**255 * \brief Set the diffuse lighting/shading coefficient256 */257 void Volume::setDiffuse(double coeff)258 {259 if (_volumeProp != NULL) {260 _volumeProp->GetProperty()->SetDiffuse(coeff);261 }262 }263 264 /**265 * \brief Set the specular lighting/shading coefficient and power266 */267 void Volume::setSpecular(double coeff, double power)268 {269 if (_volumeProp != NULL) {270 _volumeProp->GetProperty()->SetSpecular(coeff);271 _volumeProp->GetProperty()->SetSpecularPower(power);272 }273 }274 275 /**276 * \brief Turn on/off lighting of this object277 */278 void Volume::setLighting(bool state)279 {280 if (_volumeProp != NULL)281 _volumeProp->GetProperty()->SetShade((state ? 1 : 0));282 } -
trunk/packages/vizservers/vtkvis/RpVolume.h
r2261 r2328 15 15 #include <vtkPlaneCollection.h> 16 16 17 #include "RpVtk DataSet.h"17 #include "RpVtkGraphicsObject.h" 18 18 #include "ColorMap.h" 19 19 … … 23 23 /** 24 24 * \brief Volume Rendering 25 * 26 * Currently the DataSet must be image data (3D uniform grid), 27 * or an UnstructuredGrid 25 28 */ 26 class Volume {29 class Volume : public VtkGraphicsObject { 27 30 public: 28 31 enum BlendMode { … … 35 38 virtual ~Volume(); 36 39 37 void setDataSet(DataSet *dataset); 40 virtual const char *getClassName() const 41 { 42 return "Volume"; 43 } 38 44 39 DataSet *getDataSet();45 virtual void setOpacity(double opacity); 40 46 41 v tkProp *getProp();47 virtual void setClippingPlanes(vtkPlaneCollection *planes); 42 48 43 49 void setColorMap(ColorMap *cmap); 50 44 51 void setColorMap(ColorMap *cmap, double dataRange[2]); 45 52 46 53 ColorMap *getColorMap(); 47 54 48 void setOpacity(double opacity);49 50 void setVisibility(bool state);51 52 bool getVisibility();53 54 void setClippingPlanes(vtkPlaneCollection *planes);55 56 void setAmbient(double coeff);57 58 void setDiffuse(double coeff);59 60 void setSpecular(double coeff, double power);61 62 void setLighting(bool state);63 64 55 private: 65 void initProp(); 66 void update(); 67 68 DataSet *_dataSet; 69 double _opacity; 56 virtual void initProp(); 57 virtual void update(); 70 58 71 59 ColorMap *_colorMap; 72 vtkSmartPointer<vtkVolume> _volumeProp;73 60 vtkSmartPointer<vtkAbstractVolumeMapper> _volumeMapper; 74 61 }; -
trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp
r2320 r2328 853 853 854 854 /** 855 * \brief Turn on/off rendering of all axes 856 */ 857 void Renderer::setAxesVisibility(bool state) 858 { 859 if (_cubeAxesActor != NULL) { 860 _cubeAxesActor->SetVisibility((state ? 1 : 0)); 861 _needsRedraw = true; 862 } 863 if (_cubeAxesActor2D != NULL) { 864 _cubeAxesActor2D->SetVisibility((state ? 1 : 0)); 865 _needsRedraw = true; 866 } 867 setAxisVisibility(X_AXIS, state); 868 setAxisVisibility(Y_AXIS, state); 869 setAxisVisibility(Z_AXIS, state); 870 } 871 872 /** 855 873 * \brief Turn on/off rendering of all axes gridlines 856 874 */ 857 875 void Renderer::setAxesGridVisibility(bool state) 858 876 { 877 setAxisGridVisibility(X_AXIS, state); 878 setAxisGridVisibility(Y_AXIS, state); 879 setAxisGridVisibility(Z_AXIS, state); 880 } 881 882 /** 883 * \brief Turn on/off rendering of all axis labels 884 */ 885 void Renderer::setAxesLabelVisibility(bool state) 886 { 887 setAxisLabelVisibility(X_AXIS, state); 888 setAxisLabelVisibility(Y_AXIS, state); 889 setAxisLabelVisibility(Z_AXIS, state); 890 } 891 892 /** 893 * \brief Turn on/off rendering of all axis ticks 894 */ 895 void Renderer::setAxesTickVisibility(bool state) 896 { 897 setAxisTickVisibility(X_AXIS, state); 898 setAxisTickVisibility(Y_AXIS, state); 899 setAxisTickVisibility(Z_AXIS, state); 900 } 901 902 /** 903 * \brief Turn on/off rendering of the specified axis 904 */ 905 void Renderer::setAxisVisibility(Axis axis, bool state) 906 { 859 907 if (_cubeAxesActor != NULL) { 860 _cubeAxesActor->SetDrawXGridlines((state ? 1 : 0)); 861 _cubeAxesActor->SetDrawYGridlines((state ? 1 : 0)); 862 _cubeAxesActor->SetDrawZGridlines((state ? 1 : 0)); 908 if (axis == X_AXIS) { 909 _cubeAxesActor->SetXAxisVisibility((state ? 1 : 0)); 910 } else if (axis == Y_AXIS) { 911 _cubeAxesActor->SetYAxisVisibility((state ? 1 : 0)); 912 } else if (axis == Z_AXIS) { 913 _cubeAxesActor->SetZAxisVisibility((state ? 1 : 0)); 914 } 915 _needsRedraw = true; 916 } 917 if (_cubeAxesActor2D != NULL) { 918 if (axis == X_AXIS) { 919 _cubeAxesActor2D->SetXAxisVisibility((state ? 1 : 0)); 920 } else if (axis == Y_AXIS) { 921 _cubeAxesActor2D->SetYAxisVisibility((state ? 1 : 0)); 922 } 863 923 _needsRedraw = true; 864 924 } … … 883 943 884 944 /** 885 * \brief Turn on/off rendering of all axes 886 */ 887 void Renderer::setAxesVisibility(bool state) 888 { 889 if (_cubeAxesActor != NULL) { 890 _cubeAxesActor->SetVisibility((state ? 1 : 0)); 891 _needsRedraw = true; 892 } 893 if (_cubeAxesActor2D != NULL) { 894 _cubeAxesActor2D->SetVisibility((state ? 1 : 0)); 895 _needsRedraw = true; 896 } 897 setAxisVisibility(X_AXIS, state); 898 setAxisVisibility(Y_AXIS, state); 899 setAxisVisibility(Z_AXIS, state); 900 } 901 902 /** 903 * \brief Turn on/off rendering of the specified axis 904 */ 905 void Renderer::setAxisVisibility(Axis axis, bool state) 945 * \brief Toggle label visibility for the specified axis 946 */ 947 void Renderer::setAxisLabelVisibility(Axis axis, bool state) 906 948 { 907 949 if (_cubeAxesActor != NULL) { 908 950 if (axis == X_AXIS) { 909 _cubeAxesActor->SetXAxis Visibility((state ? 1 : 0));951 _cubeAxesActor->SetXAxisLabelVisibility((state ? 1 : 0)); 910 952 } else if (axis == Y_AXIS) { 911 _cubeAxesActor->SetYAxis Visibility((state ? 1 : 0));953 _cubeAxesActor->SetYAxisLabelVisibility((state ? 1 : 0)); 912 954 } else if (axis == Z_AXIS) { 913 _cubeAxesActor->SetZAxis Visibility((state ? 1 : 0));955 _cubeAxesActor->SetZAxisLabelVisibility((state ? 1 : 0)); 914 956 } 915 957 _needsRedraw = true; … … 917 959 if (_cubeAxesActor2D != NULL) { 918 960 if (axis == X_AXIS) { 919 _cubeAxesActor2D-> SetXAxisVisibility((state ? 1 : 0));961 _cubeAxesActor2D->GetXAxisActor2D()->SetLabelVisibility((state ? 1 : 0)); 920 962 } else if (axis == Y_AXIS) { 921 _cubeAxesActor2D->SetYAxisVisibility((state ? 1 : 0)); 963 _cubeAxesActor2D->GetYAxisActor2D()->SetLabelVisibility((state ? 1 : 0)); 964 } 965 _needsRedraw = true; 966 } 967 } 968 969 /** 970 * \brief Toggle tick visibility for the specified axis 971 */ 972 void Renderer::setAxisTickVisibility(Axis axis, bool state) 973 { 974 if (_cubeAxesActor != NULL) { 975 if (axis == X_AXIS) { 976 _cubeAxesActor->SetXAxisTickVisibility((state ? 1 : 0)); 977 } else if (axis == Y_AXIS) { 978 _cubeAxesActor->SetYAxisTickVisibility((state ? 1 : 0)); 979 } else if (axis == Z_AXIS) { 980 _cubeAxesActor->SetZAxisTickVisibility((state ? 1 : 0)); 981 } 982 _needsRedraw = true; 983 } 984 if (_cubeAxesActor2D != NULL) { 985 if (axis == X_AXIS) { 986 _cubeAxesActor2D->GetXAxisActor2D()->SetTickVisibility((state ? 1 : 0)); 987 } else if (axis == Y_AXIS) { 988 _cubeAxesActor2D->GetYAxisActor2D()->SetTickVisibility((state ? 1 : 0)); 922 989 } 923 990 _needsRedraw = true; … … 2033 2100 2034 2101 /** 2102 * \brief Turn on/off wireframe rendering of Glyphs for the given DataSet 2103 */ 2104 void Renderer::setGlyphsWireframe(const DataSetId& id, bool state) 2105 { 2106 GlyphsHashmap::iterator itr; 2107 2108 bool doAll = false; 2109 2110 if (id.compare("all") == 0) { 2111 itr = _glyphs.begin(); 2112 doAll = true; 2113 } else { 2114 itr = _glyphs.find(id); 2115 } 2116 if (itr == _glyphs.end()) { 2117 ERROR("Glyphs not found: %s", id.c_str()); 2118 return; 2119 } 2120 2121 do { 2122 itr->second->setWireframe(state); 2123 } while (doAll && ++itr != _glyphs.end()); 2124 2125 _needsRedraw = true; 2126 } 2127 2128 /** 2035 2129 * \brief Turn Glyphs lighting on/off for the specified DataSet 2036 2130 */ … … 2130 2224 2131 2225 /** 2226 * \brief Set an additional transform on the prop 2227 */ 2228 void Renderer::setHeightMapTransform(const DataSetId& id, vtkMatrix4x4 *trans) 2229 { 2230 HeightMapHashmap::iterator itr; 2231 2232 bool doAll = false; 2233 2234 if (id.compare("all") == 0) { 2235 itr = _heightMaps.begin(); 2236 doAll = true; 2237 } else { 2238 itr = _heightMaps.find(id); 2239 } 2240 if (itr == _heightMaps.end()) { 2241 ERROR("HeightMap not found: %s", id.c_str()); 2242 return; 2243 } 2244 2245 do { 2246 itr->second->setTransform(trans); 2247 } while (doAll && ++itr != _heightMaps.end()); 2248 2249 resetAxes(); 2250 _needsRedraw = true; 2251 } 2252 2253 /** 2254 * \brief Set the prop orientation with a quaternion 2255 */ 2256 void Renderer::setHeightMapOrientation(const DataSetId& id, double quat[4]) 2257 { 2258 HeightMapHashmap::iterator itr; 2259 2260 bool doAll = false; 2261 2262 if (id.compare("all") == 0) { 2263 itr = _heightMaps.begin(); 2264 doAll = true; 2265 } else { 2266 itr = _heightMaps.find(id); 2267 } 2268 if (itr == _heightMaps.end()) { 2269 ERROR("HeightMap not found: %s", id.c_str()); 2270 return; 2271 } 2272 2273 do { 2274 itr->second->setOrientation(quat); 2275 } while (doAll && ++itr != _heightMaps.end()); 2276 2277 resetAxes(); 2278 _needsRedraw = true; 2279 } 2280 2281 /** 2282 * \brief Set the prop orientation with a rotation about an axis 2283 */ 2284 void Renderer::setHeightMapOrientation(const DataSetId& id, double angle, double axis[3]) 2285 { 2286 HeightMapHashmap::iterator itr; 2287 2288 bool doAll = false; 2289 2290 if (id.compare("all") == 0) { 2291 itr = _heightMaps.begin(); 2292 doAll = true; 2293 } else { 2294 itr = _heightMaps.find(id); 2295 } 2296 if (itr == _heightMaps.end()) { 2297 ERROR("HeightMap not found: %s", id.c_str()); 2298 return; 2299 } 2300 2301 do { 2302 itr->second->setOrientation(angle, axis); 2303 } while (doAll && ++itr != _heightMaps.end()); 2304 2305 resetAxes(); 2306 _needsRedraw = true; 2307 } 2308 2309 /** 2310 * \brief Set the prop position in world coords 2311 */ 2312 void Renderer::setHeightMapPosition(const DataSetId& id, double pos[3]) 2313 { 2314 HeightMapHashmap::iterator itr; 2315 2316 bool doAll = false; 2317 2318 if (id.compare("all") == 0) { 2319 itr = _heightMaps.begin(); 2320 doAll = true; 2321 } else { 2322 itr = _heightMaps.find(id); 2323 } 2324 if (itr == _heightMaps.end()) { 2325 ERROR("HeightMap not found: %s", id.c_str()); 2326 return; 2327 } 2328 2329 do { 2330 itr->second->setPosition(pos); 2331 } while (doAll && ++itr != _heightMaps.end()); 2332 2333 resetAxes(); 2334 _needsRedraw = true; 2335 } 2336 2337 /** 2338 * \brief Set the prop scaling 2339 */ 2340 void Renderer::setHeightMapScale(const DataSetId& id, double scale[3]) 2341 { 2342 HeightMapHashmap::iterator itr; 2343 2344 bool doAll = false; 2345 2346 if (id.compare("all") == 0) { 2347 itr = _heightMaps.begin(); 2348 doAll = true; 2349 } else { 2350 itr = _heightMaps.find(id); 2351 } 2352 if (itr == _heightMaps.end()) { 2353 ERROR("HeightMap not found: %s", id.c_str()); 2354 return; 2355 } 2356 2357 do { 2358 itr->second->setScale(scale); 2359 } while (doAll && ++itr != _heightMaps.end()); 2360 2361 resetAxes(); 2362 _needsRedraw = true; 2363 } 2364 2365 /** 2132 2366 * \brief Set the volume slice used for mapping volumetric data 2133 2367 */ … … 2907 3141 2908 3142 /** 3143 * \brief Set the prop orientation with a quaternion 3144 */ 3145 void Renderer::setMoleculeTransform(const DataSetId& id, vtkMatrix4x4 *trans) 3146 { 3147 MoleculeHashmap::iterator itr; 3148 3149 bool doAll = false; 3150 3151 if (id.compare("all") == 0) { 3152 itr = _molecules.begin(); 3153 doAll = true; 3154 } else { 3155 itr = _molecules.find(id); 3156 } 3157 if (itr == _molecules.end()) { 3158 ERROR("Molecule not found: %s", id.c_str()); 3159 return; 3160 } 3161 3162 do { 3163 itr->second->setTransform(trans); 3164 } while (doAll && ++itr != _molecules.end()); 3165 3166 resetAxes(); 3167 _needsRedraw = true; 3168 } 3169 3170 /** 3171 * \brief Set the prop orientation with a quaternion 3172 */ 3173 void Renderer::setMoleculeOrientation(const DataSetId& id, double quat[4]) 3174 { 3175 MoleculeHashmap::iterator itr; 3176 3177 bool doAll = false; 3178 3179 if (id.compare("all") == 0) { 3180 itr = _molecules.begin(); 3181 doAll = true; 3182 } else { 3183 itr = _molecules.find(id); 3184 } 3185 if (itr == _molecules.end()) { 3186 ERROR("Molecule not found: %s", id.c_str()); 3187 return; 3188 } 3189 3190 do { 3191 itr->second->setOrientation(quat); 3192 } while (doAll && ++itr != _molecules.end()); 3193 3194 resetAxes(); 3195 _needsRedraw = true; 3196 } 3197 3198 /** 3199 * \brief Set the prop orientation with a rotation about an axis 3200 */ 3201 void Renderer::setMoleculeOrientation(const DataSetId& id, double angle, double axis[3]) 3202 { 3203 MoleculeHashmap::iterator itr; 3204 3205 bool doAll = false; 3206 3207 if (id.compare("all") == 0) { 3208 itr = _molecules.begin(); 3209 doAll = true; 3210 } else { 3211 itr = _molecules.find(id); 3212 } 3213 if (itr == _molecules.end()) { 3214 ERROR("Molecule not found: %s", id.c_str()); 3215 return; 3216 } 3217 3218 do { 3219 itr->second->setOrientation(angle, axis); 3220 } while (doAll && ++itr != _molecules.end()); 3221 3222 resetAxes(); 3223 _needsRedraw = true; 3224 } 3225 3226 /** 3227 * \brief Set the prop position in world coords 3228 */ 3229 void Renderer::setMoleculePosition(const DataSetId& id, double pos[3]) 3230 { 3231 MoleculeHashmap::iterator itr; 3232 3233 bool doAll = false; 3234 3235 if (id.compare("all") == 0) { 3236 itr = _molecules.begin(); 3237 doAll = true; 3238 } else { 3239 itr = _molecules.find(id); 3240 } 3241 if (itr == _molecules.end()) { 3242 ERROR("Molecule not found: %s", id.c_str()); 3243 return; 3244 } 3245 3246 do { 3247 itr->second->setPosition(pos); 3248 } while (doAll && ++itr != _molecules.end()); 3249 3250 resetAxes(); 3251 _needsRedraw = true; 3252 } 3253 3254 /** 3255 * \brief Set the prop scaling 3256 */ 3257 void Renderer::setMoleculeScale(const DataSetId& id, double scale[3]) 3258 { 3259 MoleculeHashmap::iterator itr; 3260 3261 bool doAll = false; 3262 3263 if (id.compare("all") == 0) { 3264 itr = _molecules.begin(); 3265 doAll = true; 3266 } else { 3267 itr = _molecules.find(id); 3268 } 3269 if (itr == _molecules.end()) { 3270 ERROR("Molecule not found: %s", id.c_str()); 3271 return; 3272 } 3273 3274 do { 3275 itr->second->setScale(scale); 3276 } while (doAll && ++itr != _molecules.end()); 3277 3278 resetAxes(); 3279 _needsRedraw = true; 3280 } 3281 3282 /** 2909 3283 * \brief Associate an existing named color map with a Molecule for the given DataSet 2910 3284 */ … … 3286 3660 } else 3287 3661 return itr->second; 3662 } 3663 3664 /** 3665 * \brief Set an additional transform on the prop 3666 */ 3667 void Renderer::setPolyDataTransform(const DataSetId& id, vtkMatrix4x4 *trans) 3668 { 3669 PolyDataHashmap::iterator itr; 3670 3671 bool doAll = false; 3672 3673 if (id.compare("all") == 0) { 3674 itr = _polyDatas.begin(); 3675 doAll = true; 3676 } else { 3677 itr = _polyDatas.find(id); 3678 } 3679 if (itr == _polyDatas.end()) { 3680 ERROR("PolyData not found: %s", id.c_str()); 3681 return; 3682 } 3683 3684 do { 3685 itr->second->setTransform(trans); 3686 } while (doAll && ++itr != _polyDatas.end()); 3687 3688 resetAxes(); 3689 _needsRedraw = true; 3690 } 3691 3692 /** 3693 * \brief Set the prop orientation with a quaternion 3694 */ 3695 void Renderer::setPolyDataOrientation(const DataSetId& id, double quat[4]) 3696 { 3697 PolyDataHashmap::iterator itr; 3698 3699 bool doAll = false; 3700 3701 if (id.compare("all") == 0) { 3702 itr = _polyDatas.begin(); 3703 doAll = true; 3704 } else { 3705 itr = _polyDatas.find(id); 3706 } 3707 if (itr == _polyDatas.end()) { 3708 ERROR("PolyData not found: %s", id.c_str()); 3709 return; 3710 } 3711 3712 do { 3713 itr->second->setOrientation(quat); 3714 } while (doAll && ++itr != _polyDatas.end()); 3715 3716 resetAxes(); 3717 _needsRedraw = true; 3718 } 3719 3720 /** 3721 * \brief Set the prop orientation with a rotation about an axis 3722 */ 3723 void Renderer::setPolyDataOrientation(const DataSetId& id, double angle, double axis[3]) 3724 { 3725 PolyDataHashmap::iterator itr; 3726 3727 bool doAll = false; 3728 3729 if (id.compare("all") == 0) { 3730 itr = _polyDatas.begin(); 3731 doAll = true; 3732 } else { 3733 itr = _polyDatas.find(id); 3734 } 3735 if (itr == _polyDatas.end()) { 3736 ERROR("PolyData not found: %s", id.c_str()); 3737 return; 3738 } 3739 3740 do { 3741 itr->second->setOrientation(angle, axis); 3742 } while (doAll && ++itr != _polyDatas.end()); 3743 3744 resetAxes(); 3745 _needsRedraw = true; 3746 } 3747 3748 /** 3749 * \brief Set the prop position in world coords 3750 */ 3751 void Renderer::setPolyDataPosition(const DataSetId& id, double pos[3]) 3752 { 3753 PolyDataHashmap::iterator itr; 3754 3755 bool doAll = false; 3756 3757 if (id.compare("all") == 0) { 3758 itr = _polyDatas.begin(); 3759 doAll = true; 3760 } else { 3761 itr = _polyDatas.find(id); 3762 } 3763 if (itr == _polyDatas.end()) { 3764 ERROR("PolyData not found: %s", id.c_str()); 3765 return; 3766 } 3767 3768 do { 3769 itr->second->setPosition(pos); 3770 } while (doAll && ++itr != _polyDatas.end()); 3771 3772 resetAxes(); 3773 _needsRedraw = true; 3774 } 3775 3776 /** 3777 * \brief Set the prop scaling 3778 */ 3779 void Renderer::setPolyDataScale(const DataSetId& id, double scale[3]) 3780 { 3781 PolyDataHashmap::iterator itr; 3782 3783 bool doAll = false; 3784 3785 if (id.compare("all") == 0) { 3786 itr = _polyDatas.begin(); 3787 doAll = true; 3788 } else { 3789 itr = _polyDatas.find(id); 3790 } 3791 if (itr == _polyDatas.end()) { 3792 ERROR("PolyData not found: %s", id.c_str()); 3793 return; 3794 } 3795 3796 do { 3797 itr->second->setScale(scale); 3798 } while (doAll && ++itr != _polyDatas.end()); 3799 3800 resetAxes(); 3801 _needsRedraw = true; 3288 3802 } 3289 3803 … … 5840 6354 5841 6355 /** 6356 * \brief Sets flag to trigger rendering next time render() is called 6357 */ 6358 void Renderer::eventuallyRender() 6359 { 6360 _needsRedraw = true; 6361 } 6362 6363 /** 5842 6364 * \brief Cause the rendering to render a new image if needed 5843 6365 * -
trunk/packages/vizservers/vtkvis/RpVtkRenderer.h
r2320 r2328 114 114 // Render window 115 115 116 /// Get the VTK render window object this Renderer uses 116 117 vtkRenderWindow *getRenderWindow() 117 118 { … … 167 168 void setUseDepthPeeling(bool state); 168 169 170 void eventuallyRender(); 171 169 172 bool render(); 170 173 … … 175 178 void setAxesFlyMode(AxesFlyMode mode); 176 179 180 void setAxesVisibility(bool state); 181 177 182 void setAxesGridVisibility(bool state); 178 183 179 void setAxesVisibility(bool state); 184 void setAxesLabelVisibility(bool state); 185 186 void setAxesTickVisibility(bool state); 180 187 181 188 void setAxesColor(double color[3]); 182 189 190 void setAxisVisibility(Axis axis, bool state); 191 183 192 void setAxisGridVisibility(Axis axis, bool state); 184 193 185 void setAxisVisibility(Axis axis, bool state); 194 void setAxisLabelVisibility(Axis axis, bool state); 195 196 void setAxisTickVisibility(Axis axis, bool state); 186 197 187 198 void setAxisTitle(Axis axis, const char *title); … … 211 222 Contour2D *getContour2D(const DataSetId& id); 212 223 224 void setContour2DEdgeColor(const DataSetId& id, float color[3]); 225 226 void setContour2DEdgeWidth(const DataSetId& id, float edgeWidth); 227 228 void setContour2DLighting(const DataSetId& id, bool state); 229 230 void setContour2DOpacity(const DataSetId& id, double opacity); 231 232 void setContour2DVisibility(const DataSetId& id, bool state); 233 213 234 void setContour2DContours(const DataSetId& id, int numContours); 214 235 215 236 void setContour2DContourList(const DataSetId& id, const std::vector<double>& contours); 216 237 217 void setContour2DOpacity(const DataSetId& id, double opacity);218 219 void setContour2DVisibility(const DataSetId& id, bool state);220 221 void setContour2DEdgeColor(const DataSetId& id, float color[3]);222 223 void setContour2DEdgeWidth(const DataSetId& id, float edgeWidth);224 225 void setContour2DLighting(const DataSetId& id, bool state);226 227 238 // 3D Contour (isosurface) plots 228 239 … … 233 244 Contour3D *getContour3D(const DataSetId& id); 234 245 246 void setContour3DColor(const DataSetId& id, float color[3]); 247 248 void setContour3DEdgeVisibility(const DataSetId& id, bool state); 249 250 void setContour3DEdgeColor(const DataSetId& id, float color[3]); 251 252 void setContour3DEdgeWidth(const DataSetId& id, float edgeWidth); 253 254 void setContour3DLighting(const DataSetId& id, bool state); 255 256 void setContour3DOpacity(const DataSetId& id, double opacity); 257 258 void setContour3DVisibility(const DataSetId& id, bool state); 259 260 void setContour3DWireframe(const DataSetId& id, bool state); 261 235 262 void setContour3DContours(const DataSetId& id, int numContours); 236 263 … … 239 266 void setContour3DColorMap(const DataSetId& id, const ColorMapId& colorMapId); 240 267 241 void setContour3DOpacity(const DataSetId& id, double opacity);242 243 void setContour3DVisibility(const DataSetId& id, bool state);244 245 void setContour3DColor(const DataSetId& id, float color[3]);246 247 void setContour3DEdgeVisibility(const DataSetId& id, bool state);248 249 void setContour3DEdgeColor(const DataSetId& id, float color[3]);250 251 void setContour3DEdgeWidth(const DataSetId& id, float edgeWidth);252 253 void setContour3DWireframe(const DataSetId& id, bool state);254 255 void setContour3DLighting(const DataSetId& id, bool state);256 257 268 // Glyphs 258 269 … … 263 274 Glyphs *getGlyphs(const DataSetId& id); 264 275 276 void setGlyphsLighting(const DataSetId& id, bool state); 277 278 void setGlyphsOpacity(const DataSetId& id, double opacity); 279 280 void setGlyphsVisibility(const DataSetId& id, bool state); 281 282 void setGlyphsWireframe(const DataSetId& id, bool state); 283 265 284 void setGlyphsColorMap(const DataSetId& id, const ColorMapId& colorMapId); 266 285 … … 269 288 void setGlyphsScaleFactor(const DataSetId& id, double scale); 270 289 271 void setGlyphsOpacity(const DataSetId& id, double opacity);272 273 void setGlyphsVisibility(const DataSetId& id, bool state);274 275 void setGlyphsLighting(const DataSetId& id, bool state);276 277 290 // Height maps 278 291 … … 283 296 HeightMap *getHeightMap(const DataSetId& id); 284 297 298 void setHeightMapTransform(const DataSetId& id, vtkMatrix4x4 *trans); 299 300 void setHeightMapOrientation(const DataSetId& id, double quat[4]); 301 302 void setHeightMapOrientation(const DataSetId& id, double angle, double axis[3]); 303 304 void setHeightMapPosition(const DataSetId& id, double pos[3]); 305 306 void setHeightMapScale(const DataSetId& id, double scale[3]); 307 308 void setHeightMapEdgeVisibility(const DataSetId& id, bool state); 309 310 void setHeightMapEdgeColor(const DataSetId& id, float color[3]); 311 312 void setHeightMapEdgeWidth(const DataSetId& id, float edgeWidth); 313 314 void setHeightMapLighting(const DataSetId& id, bool state); 315 316 void setHeightMapOpacity(const DataSetId& id, double opacity); 317 318 void setHeightMapVisibility(const DataSetId& id, bool state); 319 285 320 void setHeightMapVolumeSlice(const DataSetId& id, HeightMap::Axis axis, double ratio); 286 321 … … 293 328 void setHeightMapContourList(const DataSetId& id, const std::vector<double>& contours); 294 329 295 void setHeightMapOpacity(const DataSetId& id, double opacity);296 297 void setHeightMapVisibility(const DataSetId& id, bool state);298 299 void setHeightMapEdgeVisibility(const DataSetId& id, bool state);300 301 void setHeightMapEdgeColor(const DataSetId& id, float color[3]);302 303 void setHeightMapEdgeWidth(const DataSetId& id, float edgeWidth);304 305 330 void setHeightMapContourVisibility(const DataSetId& id, bool state); 306 331 … … 309 334 void setHeightMapContourEdgeWidth(const DataSetId& id, float edgeWidth); 310 335 311 void setHeightMapLighting(const DataSetId& id, bool state);312 313 336 // LIC plots 314 337 … … 319 342 LIC *getLIC(const DataSetId& id); 320 343 344 void setLICEdgeVisibility(const DataSetId& id, bool state); 345 346 void setLICEdgeColor(const DataSetId& id, float color[3]); 347 348 void setLICEdgeWidth(const DataSetId& id, float edgeWidth); 349 350 void setLICLighting(const DataSetId& id, bool state); 351 352 void setLICOpacity(const DataSetId& id, double opacity); 353 354 void setLICVisibility(const DataSetId& id, bool state); 355 321 356 void setLICVolumeSlice(const DataSetId& id, LIC::Axis axis, double ratio); 322 357 323 358 void setLICColorMap(const DataSetId& id, const ColorMapId& colorMapId); 324 359 325 void setLICOpacity(const DataSetId& id, double opacity);326 327 void setLICVisibility(const DataSetId& id, bool state);328 329 void setLICEdgeVisibility(const DataSetId& id, bool state);330 331 void setLICEdgeColor(const DataSetId& id, float color[3]);332 333 void setLICEdgeWidth(const DataSetId& id, float edgeWidth);334 335 void setLICLighting(const DataSetId& id, bool state);336 337 360 // Molecules 338 361 … … 343 366 Molecule *getMolecule(const DataSetId& id); 344 367 368 void setMoleculeTransform(const DataSetId& id, vtkMatrix4x4 *trans); 369 370 void setMoleculeOrientation(const DataSetId& id, double quat[4]); 371 372 void setMoleculeOrientation(const DataSetId& id, double angle, double axis[3]); 373 374 void setMoleculePosition(const DataSetId& id, double pos[3]); 375 376 void setMoleculeScale(const DataSetId& id, double scale[3]); 377 378 void setMoleculeEdgeVisibility(const DataSetId& id, bool state); 379 380 void setMoleculeEdgeColor(const DataSetId& id, float color[3]); 381 382 void setMoleculeEdgeWidth(const DataSetId& id, float edgeWidth); 383 384 void setMoleculeLighting(const DataSetId& id, bool state); 385 386 void setMoleculeOpacity(const DataSetId& id, double opacity); 387 388 void setMoleculeVisibility(const DataSetId& id, bool state); 389 390 void setMoleculeWireframe(const DataSetId& id, bool state); 391 345 392 void setMoleculeColorMap(const DataSetId& id, const ColorMapId& colorMapId); 346 393 347 void setMoleculeOpacity(const DataSetId& id, double opacity);348 349 394 void setMoleculeAtomScaling(const DataSetId& id, Molecule::AtomScaling scaling); 350 395 … … 353 398 void setMoleculeBondVisibility(const DataSetId& id, bool state); 354 399 355 void setMoleculeVisibility(const DataSetId& id, bool state);356 357 void setMoleculeEdgeVisibility(const DataSetId& id, bool state);358 359 void setMoleculeEdgeColor(const DataSetId& id, float color[3]);360 361 void setMoleculeEdgeWidth(const DataSetId& id, float edgeWidth);362 363 void setMoleculeWireframe(const DataSetId& id, bool state);364 365 void setMoleculeLighting(const DataSetId& id, bool state);366 367 400 // PolyData Meshes 368 401 … … 373 406 PolyData *getPolyData(const DataSetId& id); 374 407 408 void setPolyDataTransform(const DataSetId& id, vtkMatrix4x4 *trans); 409 410 void setPolyDataOrientation(const DataSetId& id, double quat[4]); 411 412 void setPolyDataOrientation(const DataSetId& id, double angle, double axis[3]); 413 414 void setPolyDataPosition(const DataSetId& id, double pos[3]); 415 416 void setPolyDataScale(const DataSetId& id, double scale[3]); 417 418 void setPolyDataColor(const DataSetId& id, float color[3]); 419 420 void setPolyDataEdgeVisibility(const DataSetId& id, bool state); 421 422 void setPolyDataEdgeColor(const DataSetId& id, float color[3]); 423 424 void setPolyDataEdgeWidth(const DataSetId& id, float edgeWidth); 425 426 void setPolyDataLighting(const DataSetId& id, bool state); 427 375 428 void setPolyDataOpacity(const DataSetId& id, double opacity); 376 429 377 430 void setPolyDataVisibility(const DataSetId& id, bool state); 378 431 379 void setPolyDataColor(const DataSetId& id, float color[3]);380 381 void setPolyDataEdgeVisibility(const DataSetId& id, bool state);382 383 void setPolyDataEdgeColor(const DataSetId& id, float color[3]);384 385 void setPolyDataEdgeWidth(const DataSetId& id, float edgeWidth);386 387 432 void setPolyDataWireframe(const DataSetId& id, bool state); 388 433 389 void setPolyDataLighting(const DataSetId& id, bool state);390 434 391 435 // Color-mapped surfaces … … 396 440 397 441 PseudoColor *getPseudoColor(const DataSetId& id); 442 443 void setPseudoColorEdgeVisibility(const DataSetId& id, bool state); 444 445 void setPseudoColorEdgeColor(const DataSetId& id, float color[3]); 446 447 void setPseudoColorEdgeWidth(const DataSetId& id, float edgeWidth); 448 449 void setPseudoColorLighting(const DataSetId& id, bool state); 450 451 void setPseudoColorOpacity(const DataSetId& id, double opacity); 452 453 void setPseudoColorVisibility(const DataSetId& id, bool state); 454 455 void setPseudoColorWireframe(const DataSetId& id, bool state); 398 456 399 457 void setPseudoColorColorMap(const DataSetId& id, const ColorMapId& colorMapId); 400 458 401 void setPseudoColorOpacity(const DataSetId& id, double opacity);402 403 void setPseudoColorVisibility(const DataSetId& id, bool state);404 405 void setPseudoColorEdgeVisibility(const DataSetId& id, bool state);406 407 void setPseudoColorEdgeColor(const DataSetId& id, float color[3]);408 409 void setPseudoColorEdgeWidth(const DataSetId& id, float edgeWidth);410 411 void setPseudoColorWireframe(const DataSetId& id, bool state);412 413 void setPseudoColorLighting(const DataSetId& id, bool state);414 415 459 // Streamlines 416 460 … … 420 464 421 465 Streamlines *getStreamlines(const DataSetId& id); 466 467 void setStreamlinesEdgeVisibility(const DataSetId& id, bool state); 468 469 void setStreamlinesEdgeColor(const DataSetId& id, float color[3]); 470 471 void setStreamlinesEdgeWidth(const DataSetId& id, float edgeWidth); 472 473 void setStreamlinesLighting(const DataSetId& id, bool state); 474 475 void setStreamlinesOpacity(const DataSetId& id, double opacity); 476 477 void setStreamlinesVisibility(const DataSetId& id, bool state); 422 478 423 479 void setStreamlinesSeedToRandomPoints(const DataSetId& id, int numPoints); … … 436 492 void setStreamlinesTypeToRibbons(const DataSetId& id, double width, double angle); 437 493 438 void setStreamlinesOpacity(const DataSetId& id, double opacity);439 440 void setStreamlinesVisibility(const DataSetId& id, bool state);441 442 494 void setStreamlinesSeedVisibility(const DataSetId& id, bool state); 443 495 … … 446 498 void setStreamlinesSeedColor(const DataSetId& id, float color[3]); 447 499 448 void setStreamlinesEdgeVisibility(const DataSetId& id, bool state);449 450 void setStreamlinesEdgeColor(const DataSetId& id, float color[3]);451 452 void setStreamlinesEdgeWidth(const DataSetId& id, float edgeWidth);453 454 void setStreamlinesLighting(const DataSetId& id, bool state);455 456 500 // Volumes 457 501 … … 461 505 462 506 Volume *getVolume(const DataSetId& id); 507 508 void setVolumeAmbient(const DataSetId& id, double coeff); 509 510 void setVolumeDiffuse(const DataSetId& id, double coeff); 511 512 void setVolumeSpecular(const DataSetId& id, double coeff, double power); 513 514 void setVolumeLighting(const DataSetId& id, bool state); 515 516 void setVolumeOpacity(const DataSetId& id, double opacity); 517 518 void setVolumeVisibility(const DataSetId& id, bool state); 463 519 464 520 void setVolumeColorMap(const DataSetId& id, const ColorMapId& colorMapId); 465 466 void setVolumeOpacity(const DataSetId& id, double opacity);467 468 void setVolumeVisibility(const DataSetId& id, bool state);469 470 void setVolumeAmbient(const DataSetId& id, double coeff);471 472 void setVolumeDiffuse(const DataSetId& id, double coeff);473 474 void setVolumeSpecular(const DataSetId& id, double coeff, double power);475 476 void setVolumeLighting(const DataSetId& id, bool state);477 521 478 522 private: -
trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp
r2320 r2328 126 126 127 127 static int 128 AxisLabelsVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc, 129 Tcl_Obj *const *objv) 130 { 131 bool visible; 132 if (GetBooleanFromObj(interp, objv[3], &visible) != TCL_OK) { 133 return TCL_ERROR; 134 } 135 const char *string = Tcl_GetString(objv[2]); 136 char c = string[0]; 137 if ((c == 'x') && (strcmp(string, "x") == 0)) { 138 g_renderer->setAxisLabelVisibility(Renderer::X_AXIS, visible); 139 } else if ((c == 'y') && (strcmp(string, "y") == 0)) { 140 g_renderer->setAxisLabelVisibility(Renderer::Y_AXIS, visible); 141 } else if ((c == 'z') && (strcmp(string, "z") == 0)) { 142 g_renderer->setAxisLabelVisibility(Renderer::Z_AXIS, visible); 143 } else if ((c == 'a') && (strcmp(string, "all") == 0)) { 144 g_renderer->setAxesLabelVisibility(visible); 145 } else { 146 Tcl_AppendResult(interp, "bad axis option \"", string, 147 "\": should be axisName visible", (char*)NULL); 148 return TCL_ERROR; 149 } 150 return TCL_OK; 151 } 152 153 static int 128 154 AxisNameOp(ClientData clientData, Tcl_Interp *interp, int objc, 129 155 Tcl_Obj *const *objv) … … 141 167 Tcl_AppendResult(interp, "bad axis option \"", string, 142 168 "\": should be axisName title", (char*)NULL); 169 return TCL_ERROR; 170 } 171 return TCL_OK; 172 } 173 174 static int 175 AxisTicksVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc, 176 Tcl_Obj *const *objv) 177 { 178 bool visible; 179 if (GetBooleanFromObj(interp, objv[3], &visible) != TCL_OK) { 180 return TCL_ERROR; 181 } 182 const char *string = Tcl_GetString(objv[2]); 183 char c = string[0]; 184 if ((c == 'x') && (strcmp(string, "x") == 0)) { 185 g_renderer->setAxisTickVisibility(Renderer::X_AXIS, visible); 186 } else if ((c == 'y') && (strcmp(string, "y") == 0)) { 187 g_renderer->setAxisTickVisibility(Renderer::Y_AXIS, visible); 188 } else if ((c == 'z') && (strcmp(string, "z") == 0)) { 189 g_renderer->setAxisTickVisibility(Renderer::Z_AXIS, visible); 190 } else if ((c == 'a') && (strcmp(string, "all") == 0)) { 191 g_renderer->setAxesTickVisibility(visible); 192 } else { 193 Tcl_AppendResult(interp, "bad axis option \"", string, 194 "\": should be axisName visible", (char*)NULL); 143 195 return TCL_ERROR; 144 196 } … … 197 249 {"flymode", 1, AxisFlyModeOp, 3, 3, "mode"}, 198 250 {"grid", 1, AxisGridOp, 4, 4, "axis bool"}, 251 {"labels", 1, AxisLabelsVisibleOp, 4, 4, "axis bool"}, 199 252 {"name", 1, AxisNameOp, 4, 4, "axis title"}, 253 {"ticks", 1, AxisTicksVisibleOp, 4, 4, "axis bool"}, 200 254 {"units", 1, AxisUnitsOp, 4, 4, "axis units"}, 201 255 {"visible", 1, AxisVisibleOp, 4, 4, "axis bool"} … … 1383 1437 } 1384 1438 1439 static int 1440 GlyphsWireframeOp(ClientData clientData, Tcl_Interp *interp, int objc, 1441 Tcl_Obj *const *objv) 1442 { 1443 bool state; 1444 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 1445 return TCL_ERROR; 1446 } 1447 if (objc == 4) { 1448 const char *name = Tcl_GetString(objv[3]); 1449 g_renderer->setGlyphsWireframe(name, state); 1450 } else { 1451 g_renderer->setGlyphsWireframe("all", state); 1452 } 1453 return TCL_OK; 1454 } 1455 1385 1456 static Rappture::CmdSpec glyphsOps[] = { 1386 {"add", 1, GlyphsAddOp, 3, 4, "shape ?dataSetNme?"}, 1387 {"colormap", 1, GlyphsColorMapOp, 3, 4, "colorMapName ?dataSetNme?"}, 1388 {"delete", 1, GlyphsDeleteOp, 2, 3, "?dataSetName?"}, 1389 {"lighting", 1, GlyphsLightingOp, 3, 4, "bool ?dataSetName?"}, 1390 {"opacity", 1, GlyphsOpacityOp, 3, 4, "value ?dataSetName?"}, 1391 {"scale", 2, GlyphsScaleOp, 3, 4, "scaleFactor ?dataSetName?"}, 1392 {"shape", 2, GlyphsShapeOp, 3, 4, "shapeVal ?dataSetName?"}, 1393 {"visible", 1, GlyphsVisibleOp, 3, 4, "bool ?dataSetName?"} 1457 {"add", 1, GlyphsAddOp, 3, 4, "shape ?dataSetNme?"}, 1458 {"colormap", 1, GlyphsColorMapOp, 3, 4, "colorMapName ?dataSetNme?"}, 1459 {"delete", 1, GlyphsDeleteOp, 2, 3, "?dataSetName?"}, 1460 {"lighting", 1, GlyphsLightingOp, 3, 4, "bool ?dataSetName?"}, 1461 {"opacity", 1, GlyphsOpacityOp, 3, 4, "value ?dataSetName?"}, 1462 {"scale", 2, GlyphsScaleOp, 3, 4, "scaleFactor ?dataSetName?"}, 1463 {"shape", 2, GlyphsShapeOp, 3, 4, "shapeVal ?dataSetName?"}, 1464 {"visible", 1, GlyphsVisibleOp, 3, 4, "bool ?dataSetName?"}, 1465 {"wireframe", 1, GlyphsWireframeOp, 3, 4, "bool ?dataSetName?"} 1394 1466 }; 1395 1467 static int nGlyphsOps = NumCmdSpecs(glyphsOps); … … 1660 1732 } else { 1661 1733 g_renderer->setHeightMapOpacity("all", opacity); 1734 } 1735 return TCL_OK; 1736 } 1737 1738 static int 1739 HeightMapOrientOp(ClientData clientData, Tcl_Interp *interp, int objc, 1740 Tcl_Obj *const *objv) 1741 { 1742 double quat[4]; 1743 if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK || 1744 Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK || 1745 Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK || 1746 Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) { 1747 return TCL_ERROR; 1748 } 1749 if (objc == 7) { 1750 const char *name = Tcl_GetString(objv[6]); 1751 g_renderer->setHeightMapOrientation(name, quat); 1752 } else { 1753 g_renderer->setHeightMapOrientation("all", quat); 1754 } 1755 return TCL_OK; 1756 } 1757 1758 static int 1759 HeightMapPositionOp(ClientData clientData, Tcl_Interp *interp, int objc, 1760 Tcl_Obj *const *objv) 1761 { 1762 double pos[3]; 1763 if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK || 1764 Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK || 1765 Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) { 1766 return TCL_ERROR; 1767 } 1768 if (objc == 6) { 1769 const char *name = Tcl_GetString(objv[5]); 1770 g_renderer->setHeightMapPosition(name, pos); 1771 } else { 1772 g_renderer->setHeightMapPosition("all", pos); 1773 } 1774 return TCL_OK; 1775 } 1776 1777 static int 1778 HeightMapScaleOp(ClientData clientData, Tcl_Interp *interp, int objc, 1779 Tcl_Obj *const *objv) 1780 { 1781 double scale[3]; 1782 if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK || 1783 Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK || 1784 Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) { 1785 return TCL_ERROR; 1786 } 1787 if (objc == 6) { 1788 const char *name = Tcl_GetString(objv[5]); 1789 g_renderer->setHeightMapScale(name, scale); 1790 } else { 1791 g_renderer->setHeightMapScale("all", scale); 1662 1792 } 1663 1793 return TCL_OK; … … 1724 1854 {"linecolor", 5, HeightMapLineColorOp, 5, 6, "r g b ?dataSetName?"}, 1725 1855 {"linewidth", 5, HeightMapLineWidthOp, 3, 4, "width ?dataSetName?"}, 1726 {"opacity", 1, HeightMapOpacityOp, 3, 4, "value ?dataSetName?"}, 1856 {"opacity", 2, HeightMapOpacityOp, 3, 4, "value ?dataSetName?"}, 1857 {"orient", 2, HeightMapOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"}, 1858 {"pos", 1, HeightMapPositionOp, 5, 6, "x y z ?dataSetName?"}, 1859 {"scale", 1, HeightMapScaleOp, 5, 6, "sx sy sz ?dataSetName?"}, 1727 1860 {"visible", 2, HeightMapVisibleOp, 3, 4, "bool ?dataSetName?"}, 1728 1861 {"volumeslice", 2, HeightMapVolumeSliceOp, 4, 5, "axis ratio ?dataSetName?"} … … 2190 2323 2191 2324 static int 2325 MoleculeOrientOp(ClientData clientData, Tcl_Interp *interp, int objc, 2326 Tcl_Obj *const *objv) 2327 { 2328 double quat[4]; 2329 if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK || 2330 Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK || 2331 Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK || 2332 Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) { 2333 return TCL_ERROR; 2334 } 2335 if (objc == 7) { 2336 const char *name = Tcl_GetString(objv[6]); 2337 g_renderer->setMoleculeOrientation(name, quat); 2338 } else { 2339 g_renderer->setMoleculeOrientation("all", quat); 2340 } 2341 return TCL_OK; 2342 } 2343 2344 static int 2345 MoleculePositionOp(ClientData clientData, Tcl_Interp *interp, int objc, 2346 Tcl_Obj *const *objv) 2347 { 2348 double pos[3]; 2349 if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK || 2350 Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK || 2351 Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) { 2352 return TCL_ERROR; 2353 } 2354 if (objc == 6) { 2355 const char *name = Tcl_GetString(objv[5]); 2356 g_renderer->setMoleculePosition(name, pos); 2357 } else { 2358 g_renderer->setMoleculePosition("all", pos); 2359 } 2360 return TCL_OK; 2361 } 2362 2363 static int 2364 MoleculeScaleOp(ClientData clientData, Tcl_Interp *interp, int objc, 2365 Tcl_Obj *const *objv) 2366 { 2367 double scale[3]; 2368 if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK || 2369 Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK || 2370 Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) { 2371 return TCL_ERROR; 2372 } 2373 if (objc == 6) { 2374 const char *name = Tcl_GetString(objv[5]); 2375 g_renderer->setMoleculeScale(name, scale); 2376 } else { 2377 g_renderer->setMoleculeScale("all", scale); 2378 } 2379 return TCL_OK; 2380 } 2381 2382 static int 2192 2383 MoleculeVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc, 2193 2384 Tcl_Obj *const *objv) … … 2233 2424 {"linecolor", 5, MoleculeLineColorOp, 5, 6, "r g b ?dataSetName?"}, 2234 2425 {"linewidth", 5, MoleculeLineWidthOp, 3, 4, "width ?dataSetName?"}, 2235 {"opacity", 1, MoleculeOpacityOp, 3, 4, "value ?dataSetName?"}, 2236 {"scaleatoms", 1, MoleculeAtomScalingOp, 3, 4, "scaling ?dataSetName?"}, 2426 {"opacity", 2, MoleculeOpacityOp, 3, 4, "value ?dataSetName?"}, 2427 {"orient", 2, MoleculeOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"}, 2428 {"pos", 1, MoleculePositionOp, 5, 6, "x y z ?dataSetName?"}, 2429 {"rscale", 1, MoleculeAtomScalingOp, 3, 4, "scaling ?dataSetName?"}, 2430 {"scale", 1, MoleculeScaleOp, 5, 6, "sx sy sz ?dataSetName?"}, 2237 2431 {"visible", 1, MoleculeVisibleOp, 3, 4, "bool ?dataSetName?"}, 2238 2432 {"wireframe", 1, MoleculeWireframeOp, 3, 4, "bool ?dataSetName?"} … … 2385 2579 return TCL_OK; 2386 2580 } 2581 2582 static int 2583 PolyDataOrientOp(ClientData clientData, Tcl_Interp *interp, int objc, 2584 Tcl_Obj *const *objv) 2585 { 2586 double quat[4]; 2587 if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK || 2588 Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK || 2589 Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK || 2590 Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) { 2591 return TCL_ERROR; 2592 } 2593 if (objc == 7) { 2594 const char *name = Tcl_GetString(objv[6]); 2595 g_renderer->setPolyDataOrientation(name, quat); 2596 } else { 2597 g_renderer->setPolyDataOrientation("all", quat); 2598 } 2599 return TCL_OK; 2600 } 2601 2602 static int 2603 PolyDataPositionOp(ClientData clientData, Tcl_Interp *interp, int objc, 2604 Tcl_Obj *const *objv) 2605 { 2606 double pos[3]; 2607 if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK || 2608 Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK || 2609 Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) { 2610 return TCL_ERROR; 2611 } 2612 if (objc == 6) { 2613 const char *name = Tcl_GetString(objv[5]); 2614 g_renderer->setPolyDataPosition(name, pos); 2615 } else { 2616 g_renderer->setPolyDataPosition("all", pos); 2617 } 2618 return TCL_OK; 2619 } 2620 2621 static int 2622 PolyDataScaleOp(ClientData clientData, Tcl_Interp *interp, int objc, 2623 Tcl_Obj *const *objv) 2624 { 2625 double scale[3]; 2626 if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK || 2627 Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK || 2628 Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) { 2629 return TCL_ERROR; 2630 } 2631 if (objc == 6) { 2632 const char *name = Tcl_GetString(objv[5]); 2633 g_renderer->setPolyDataScale(name, scale); 2634 } else { 2635 g_renderer->setPolyDataScale("all", scale); 2636 } 2637 return TCL_OK; 2638 } 2639 2387 2640 2388 2641 static int … … 2428 2681 {"linecolor", 5, PolyDataLineColorOp, 5, 6, "r g b ?dataSetName?"}, 2429 2682 {"linewidth", 5, PolyDataLineWidthOp, 3, 4, "width ?dataSetName?"}, 2430 {"opacity", 1, PolyDataOpacityOp, 3, 4, "value ?dataSetName?"}, 2683 {"opacity", 2, PolyDataOpacityOp, 3, 4, "value ?dataSetName?"}, 2684 {"orient", 2, PolyDataOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"}, 2685 {"pos", 1, PolyDataPositionOp, 5, 6, "x y z ?dataSetName?"}, 2686 {"scale", 1, PolyDataScaleOp, 5, 6, "sx sy sz ?dataSetName?"}, 2431 2687 {"visible", 1, PolyDataVisibleOp, 3, 4, "bool ?dataSetName?"}, 2432 2688 {"wireframe", 1, PolyDataWireframeOp, 3, 4, "bool ?dataSetName?"} … … 2679 2935 } 2680 2936 2937 static int 2938 RendererRenderOp(ClientData clientData, Tcl_Interp *interp, int objc, 2939 Tcl_Obj *const *objv) 2940 { 2941 g_renderer->eventuallyRender(); 2942 return TCL_OK; 2943 } 2944 2681 2945 static Rappture::CmdSpec rendererOps[] = { 2682 2946 {"clipplane", 1, RendererClipPlaneOp, 5, 5, "axis ratio direction"}, 2683 {"depthpeel", 1, RendererDepthPeelingOp, 3, 3, "bool"} 2947 {"depthpeel", 1, RendererDepthPeelingOp, 3, 3, "bool"}, 2948 {"render", 1, RendererRenderOp, 2, 2, ""} 2684 2949 }; 2685 2950 static int nRendererOps = NumCmdSpecs(rendererOps); -
trunk/packages/vizservers/vtkvis/protocol.txt
r2320 r2328 21 21 <mode> = static_edges|static_triad|outer_edges|furthest_triad|closest_triad 22 22 axis grid <bool> 23 axis labels <axis> <bool> 24 Toggle visibility of axis labels 25 <axis> = x|y|z|all 23 26 axis name <axis> <title> 27 axis ticks <axis> <bool> 28 Toggle visibility of axis tick marks 29 <axis> = x|y|z|all 24 30 axis units <axis> <units> 25 31 Currently only supported when camera mode is not image mode … … 106 112 glyphs shape <arrow|cone|cube|cylinder|dodecahedron|icosahedron|octahedron|sphere|tetrahedron> <?datasetName?> 107 113 glyphs visible <bool> <?datasetName?> 114 glyphs wireframe <bool> <?datasetName?> 108 115 109 116 heightmap add numcontours <n> <?dataSetName?> … … 123 130 heightmap linewidth <width> <?dataSetName?> 124 131 heightmap opacity <value> <?dataSetName?> 132 heightmap orient <qw> <qx> <qy> <qz> <?dataSetName?> 133 heightmap pos <x> <y> <z> <?dataSetName?> 134 heightmap scale <sx> <sy> <sz> <?dataSetName?> 125 135 heightmap visible <bool> <?dataSetName?> 126 136 heightmap volumeslice axis ratio <?dataSetName?> … … 151 161 molecule linewidth <val> <?datasetName?> 152 162 molecule opacity <val> <?datasetName?> 153 molecule scaleatoms <val> <?dataSetName?> 163 molecule orient <qw> <qx> <qy> <qz> <?dataSetName?> 164 molecule pos <x> <y> <z> <?dataSetName?> 165 molecule rscale <val> <?dataSetName?> 166 Atom radius scaling 154 167 val = van_der_walls|covalent|atomic|none 168 molecule scale <sx> <sy> <sz> <?dataSetName?> 155 169 molecule visible <bool> <?datasetName?> 156 170 molecule wireframe <bool> <?datasetName?> … … 164 178 polydata linewidth <val> <?datasetName?> 165 179 polydata opacity <val> <?datasetName?> 180 polydata orient <qw> <qx> <qy> <qz> <?dataSetName?> 181 polydata pos <x> <y> <z> <?dataSetName?> 182 polydata scale <sx> <sy> <sz> <?dataSetName?> 166 183 polydata visible <bool> <?datasetName?> 167 184 polydata wireframe <bool> <?datasetName?>
Note: See TracChangeset
for help on using the changeset viewer.