Ignore:
Timestamp:
Aug 2, 2011, 12:27:27 PM (13 years ago)
Author:
ldelgass
Message:

Collect common actor/volume/assembly settings into VtkGraphicsObject? base class.
Begin adding protocol for positioning and orienting actors. Add toggles for
ticks and labels on axes.

Location:
trunk/packages/vizservers/vtkvis
Files:
1 added
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/vtkvis/Makefile.in

    r2320 r2328  
    129129ColorMap.o: ColorMap.h RpMolecule.h Trace.h
    130130PPMWriter.o: PPMWriter.h Trace.h
    131 RpContour2D.o: RpContour2D.h RpVtkDataSet.h Trace.h
    132 RpContour3D.o: RpContour3D.h RpVtkDataSet.h Trace.h
    133 RpGlyphs.o: RpGlyphs.h RpVtkDataSet.h ColorMap.h Trace.h
    134 RpHeightMap.o: RpHeightMap.h RpVtkDataSet.h Trace.h
    135 RpLIC.o: RpLIC.h RpVtkDataSet.h Trace.h RpVtkRenderServer.h
    136 RpMolecule.o: RpMolecule.h RpMoleculeData.h RpVtkDataSet.h ColorMap.h Trace.h
    137 RpPolyData.o: RpPolyData.h RpVtkDataSet.h Trace.h
    138 RpPseudoColor.o: RpPseudoColor.h RpVtkDataSet.h Trace.h
    139 RpStreamlines.o: RpStreamlines.h RpVtkDataSet.h Trace.h
    140 RpVolume.o: RpVolume.h RpVtkDataSet.h ColorMap.h Trace.h
     131RpContour2D.o: RpContour2D.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h
     132RpContour3D.o: RpContour3D.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h
     133RpGlyphs.o: RpGlyphs.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h
     134RpHeightMap.o: RpHeightMap.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h
     135RpLIC.o: RpLIC.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h RpVtkRenderServer.h
     136RpMolecule.o: RpMolecule.h RpMoleculeData.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h
     137RpPolyData.o: RpPolyData.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h
     138RpPseudoColor.o: RpPseudoColor.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h
     139RpStreamlines.o: RpStreamlines.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h
     140RpVolume.o: RpVolume.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h
    141141RpVtkDataSet.o: RpVtkDataSet.h Trace.h
    142142RpVtkRenderer.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  
    2626
    2727Contour2D::Contour2D() :
    28     _dataSet(NULL),
    29     _numContours(0),
    30     _edgeWidth(1.0f),
    31     _opacity(1.0)
     28    VtkGraphicsObject(),
     29    _numContours(0)
    3230{
    3331    _dataRange[0] = 0;
    3432    _dataRange[1] = 1;
    35     _edgeColor[0] = 0;
    36     _edgeColor[1] = 0;
    37     _edgeColor[2] = 0;
    3833}
    3934
     
    6863
    6964/**
    70  * \brief Returns the DataSet this Contour2D renders
    71  */
    72 DataSet *Contour2D::getDataSet()
    73 {
    74     return _dataSet;
    75 }
    76 
    77 /**
    78  * \brief Get the VTK Prop for the contour lines
    79  */
    80 vtkProp *Contour2D::getProp()
    81 {
    82     return _contourActor;
    83 }
    84 
    85 /**
    8665 * \brief Create and initialize a VTK Prop to render isolines
    8766 */
    8867void Contour2D::initProp()
    8968{
    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();
    9878    }
    9979}
     
    189169        _contourMapper->SetResolveCoincidentTopologyToPolygonOffset();
    190170        _contourMapper->SetInputConnection(_contourFilter->GetOutputPort());
    191         _contourActor->SetMapper(_contourMapper);
     171        getActor()->SetMapper(_contourMapper);
    192172    }
    193173
     
    263243
    264244/**
    265  * \brief Turn on/off rendering of this contour set
    266  */
    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 set
    276  *
    277  * \return Is contour set visible?
    278  */
    279 bool Contour2D::getVisibility() const
    280 {
    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 lines
    290  */
    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 lines
    300  */
    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 /**
    321245 * \brief Set a group of world coordinate planes to clip rendering
    322246 *
     
    329253    }
    330254}
    331 
    332 /**
    333  * \brief Turn on/off lighting of this object
    334  */
    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  
    1717#include <vector>
    1818
    19 #include "RpVtkDataSet.h"
     19#include "RpVtkGraphicsObject.h"
    2020
    2121namespace Rappture {
     
    2525 * \brief 2D Contour lines (isolines)
    2626 */
    27 class Contour2D {
     27class Contour2D : public VtkGraphicsObject {
    2828public:
    2929    Contour2D();
    3030    virtual ~Contour2D();
    3131
    32     void setDataSet(DataSet *dataset);
     32    virtual const char *getClassName() const
     33    {
     34        return "Contour2D";
     35    }
    3336
    34     DataSet *getDataSet();
     37    virtual void setDataSet(DataSet *dataset);
    3538
    36     vtkProp *getProp();
     39    virtual void setClippingPlanes(vtkPlaneCollection *planes);
    3740
    3841    void setContours(int numContours);
     
    4649    const std::vector<double>& getContourList() const;
    4750
    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 
    6251private:
    63     void initProp();
    64     void update();
    65 
    66     DataSet *_dataSet;
     52    virtual void initProp();
     53    virtual void update();
    6754
    6855    int _numContours;
     
    7057    double _dataRange[2];
    7158
    72     float _edgeColor[3];
    73     float _edgeWidth;
    74     double _opacity;
    7559    vtkSmartPointer<vtkContourFilter> _contourFilter;
    7660    vtkSmartPointer<vtkPolyDataMapper> _contourMapper;
    77     vtkSmartPointer<vtkActor> _contourActor;
    7861};
    7962
  • trunk/packages/vizservers/vtkvis/RpContour3D.cpp

    r2319 r2328  
    2626
    2727Contour3D::Contour3D() :
    28     _dataSet(NULL),
    29     _numContours(0),
    30     _edgeWidth(1.0f),
    31     _opacity(1.0),
    32     _lighting(true)
     28    VtkGraphicsObject(),
     29    _numContours(0)
    3330{
    3431    _dataRange[0] = 0;
    3532    _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;
    4236}
    4337
     
    7266
    7367/**
    74  * \brief Returns the DataSet this Contour3D renders
    75  */
    76 DataSet *Contour3D::getDataSet()
    77 {
    78     return _dataSet;
    79 }
    80 
    81 /**
    82  * \brief Get the VTK Prop for the isosurfaces
    83  */
    84 vtkProp *Contour3D::getProp()
    85 {
    86     return _contourActor;
    87 }
    88 
    89 /**
    9068 * \brief Create and initialize a VTK Prop to render isosurfaces
    9169 */
    9270void Contour3D::initProp()
    9371{
    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);
    10281        if (!_lighting)
    103             _contourActor->GetProperty()->LightingOff();
     82            property->LightingOff();
    10483    }
    10584}
     
    216195        _contourMapper->SetResolveCoincidentTopologyToPolygonOffset();
    217196        _contourMapper->SetInputConnection(_contourFilter->GetOutputPort());
    218         _contourActor->SetMapper(_contourMapper);
     197        getActor()->SetMapper(_contourMapper);
    219198    }
    220199
     
    317296
    318297/**
    319  * \brief Turn on/off rendering of this contour set
    320  */
    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 set
    330  *
    331  * \return Is contour set visible?
    332  */
    333 bool Contour3D::getVisibility() const
    334 {
    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 isosurfaces
    344  */
    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 representations
    354  */
    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 isosurfaces
    370  */
    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 edges
    382  */
    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 edges
    392  */
    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 /**
    413298 * \brief Set a group of world coordinate planes to clip rendering
    414299 *
     
    421306    }
    422307}
    423 
    424 /**
    425  * \brief Turn on/off lighting of this object
    426  */
    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  
    1818#include <vector>
    1919
    20 #include "RpVtkDataSet.h"
     20#include "RpVtkGraphicsObject.h"
    2121
    2222namespace Rappture {
     
    2626 * \brief 3D Contour isosurfaces (geometry)
    2727 */
    28 class Contour3D {
     28class Contour3D : public VtkGraphicsObject {
    2929public:
    3030    Contour3D();
    3131    virtual ~Contour3D();
    3232
    33     void setDataSet(DataSet *dataset);
     33    virtual const char *getClassName() const
     34    {
     35        return "Contour3D";
     36    }
    3437
    35     DataSet *getDataSet();
     38    virtual void setDataSet(DataSet *dataset);
    3639
    37     vtkProp *getProp();
     40    virtual void setClippingPlanes(vtkPlaneCollection *planes);
    3841
    3942    void setContours(int numContours);
     
    4750    const std::vector<double>& getContourList() const;
    4851
    49     void setVisibility(bool state);
    50 
    51     bool getVisibility() const;
    52 
    53     void setOpacity(double opacity);
    54 
    55     void setWireframe(bool state);
    56 
    5752    void setLookupTable(vtkLookupTable *lut);
    5853
    5954    vtkLookupTable *getLookupTable();
    6055
    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 
    7356private:
    74     void initProp();
    75     void update();
    76 
    77     DataSet *_dataSet;
     57    virtual void initProp();
     58    virtual void update();
    7859
    7960    int _numContours;
     
    8162    double _dataRange[2];
    8263
    83     float _color[3];
    84     float _edgeColor[3];
    85     float _edgeWidth;
    86     double _opacity;
    87     bool _lighting;
    88 
    8964    vtkSmartPointer<vtkContourFilter> _contourFilter;
    9065    vtkSmartPointer<vtkLookupTable> _lut;
    9166    vtkSmartPointer<vtkPolyDataMapper> _contourMapper;
    92     vtkSmartPointer<vtkActor> _contourActor;
    9367};
    9468
  • trunk/packages/vizservers/vtkvis/RpGlyphs.cpp

    r2319 r2328  
    2727
    2828Glyphs::Glyphs() :
    29     _dataSet(NULL),
    30     _opacity(1.0),
    31     _lighting(true),
     29    VtkGraphicsObject(),
    3230    _glyphShape(ARROW),
    3331    _scaleFactor(1.0)
     
    3735Glyphs::~Glyphs()
    3836{
    39 }
    40 
    41 /**
    42  * \brief Get the VTK Prop for the Glyphs
    43  */
    44 vtkProp *Glyphs::getProp()
    45 {
    46     return _prop;
    47 }
    48 
    49 /**
    50  * \brief Create and initialize a VTK Prop to render Glyphs
    51  */
    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 DataSet
    66  *
    67  * The DataSet must be a PolyData point set
    68  * with vectors and/or scalars
    69  */
    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 renders
    80  */
    81 DataSet *Glyphs::getDataSet()
    82 {
    83     return _dataSet;
    8437}
    8538
     
    222175    initProp();
    223176
    224     _prop->SetMapper(_pdMapper);
     177    getActor()->SetMapper(_pdMapper);
    225178    _pdMapper->Update();
    226179}
     
    263216
    264217/**
    265  * \brief Turn on/off rendering of this Glyphs
    266  */
    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 Glyphs
    276  *
    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 Glyphs
    290  */
    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 Glyphs
    300  */
    301 double Glyphs::getOpacity()
    302 {
    303     return _opacity;
    304 }
    305 
    306 /**
    307218 * \brief Set a group of world coordinate planes to clip rendering
    308219 *
     
    315226    }
    316227}
    317 
    318 /**
    319  * \brief Turn on/off lighting of this object
    320  */
    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  
    1818#include <vtkPlaneCollection.h>
    1919
    20 #include "RpVtkDataSet.h"
     20#include "RpVtkGraphicsObject.h"
    2121#include "ColorMap.h"
    2222
     
    2626/**
    2727 * \brief Oriented and scaled 3D glyph shapes
     28 *
     29 * The DataSet must be a PolyData point set
     30 * with vectors and/or scalars
    2831 */
    29 class Glyphs {
     32class Glyphs : public VtkGraphicsObject {
    3033public:
    3134    enum GlyphShape {
     
    4447    virtual ~Glyphs();
    4548
    46     void setDataSet(DataSet *dataset);
     49    virtual const char *getClassName() const
     50    {
     51        return "Glyphs";
     52    }
    4753
    48     DataSet *getDataSet();
    49 
    50     vtkProp *getProp();
     54    virtual void setClippingPlanes(vtkPlaneCollection *planes);
    5155
    5256    void setGlyphShape(GlyphShape shape);
     
    5862    vtkLookupTable *getLookupTable();
    5963
    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 
    7264private:
    73     void initProp();
    74     void update();
    75 
    76     DataSet *_dataSet;
    77 
    78     double _opacity;
    79     bool _lighting;
     65    virtual void update();
    8066
    8167    GlyphShape _glyphShape;
     
    8369
    8470    vtkSmartPointer<vtkLookupTable> _lut;
    85     vtkSmartPointer<vtkActor> _prop;
    8671    vtkSmartPointer<vtkGlyph3D> _glyphGenerator;
    8772    vtkSmartPointer<vtkPolyDataAlgorithm> _glyphSource;
  • trunk/packages/vizservers/vtkvis/RpHeightMap.cpp

    r2320 r2328  
    3636
    3737HeightMap::HeightMap() :
    38     _dataSet(NULL),
     38    VtkGraphicsObject(),
    3939    _numContours(0),
    40     _edgeWidth(1.0),
    4140    _contourEdgeWidth(1.0),
    42     _opacity(1.0),
    4341    _warpScale(1.0),
    4442    _sliceAxis(Z_AXIS),
     
    4745    _dataRange[0] = 0.0;
    4846    _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;
    5550}
    5651
     
    107102
    108103/**
    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 */
     106void 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    }
    114130}
    115131
     
    372388    _dsActor->SetMapper(_dsMapper);
    373389
    374     if (_props == NULL) {
    375         _props = 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);
    378394    }
    379395
     
    599615
    600616/**
    601  * \brief Get the VTK Prop for the colormapped dataset
    602  */
    603 vtkProp *HeightMap::getProp()
    604 {
    605     return _props;
    606 }
    607 
    608 /**
    609  * \brief Create and initialize VTK Props to render the colormapped dataset
    610  */
    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 /**
    638617 * \brief Get the VTK colormap lookup table in use
    639618 */
     
    728707
    729708/**
    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 */
     711void HeightMap::setLighting(bool state)
     712{
     713    if (_dsActor != NULL)
     714        _dsActor->GetProperty()->SetLighting((state ? 1 : 0));
    771715}
    772716
     
    852796}
    853797
    854 /**
    855  * \brief Turn on/off lighting of this object
    856  */
    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  
    2020#include <vtkExtractVOI.h>
    2121#include <vtkWarpScalar.h>
    22 #include <vtkPropAssembly.h>
     22#include <vtkAssembly.h>
    2323#include <vtkPolyData.h>
    2424
    2525#include <vector>
    2626
    27 #include "RpVtkDataSet.h"
     27#include "RpVtkGraphicsObject.h"
    2828
    2929namespace Rappture {
     
    3333 * \brief Color-mapped plot of data set
    3434 */
    35 class HeightMap {
     35class HeightMap : public VtkGraphicsObject {
    3636public:
    3737    enum Axis {
     
    4444    virtual ~HeightMap();
    4545
    46     void setDataSet(DataSet *dataset);
     46    virtual const char *getClassName() const
     47    {
     48        return "HeightMap";
     49    }
    4750
    48     DataSet *getDataSet();
     51    virtual void setDataSet(DataSet *dataset);
    4952
    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);
    5162
    5263    void selectVolumeSlice(Axis axis, double ratio);
     
    6879    vtkLookupTable *getLookupTable();
    6980
    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 
    8281    void setContourVisibility(bool state);
    8382
     
    8685    void setContourEdgeWidth(float edgeWidth);
    8786
    88     void setClippingPlanes(vtkPlaneCollection *planes);
     87private:
     88    virtual void initProp();
     89    virtual void update();
    8990
    90     void setLighting(bool state);
    91 
    92 private:
    9391    vtkAlgorithmOutput *initWarp(vtkAlgorithmOutput *input);
    9492    vtkAlgorithmOutput *initWarp(vtkPolyData *input);
    95     void initProp();
    96     void update();
    97 
    98     DataSet * _dataSet;
    9993
    10094    int _numContours;
     
    106100    float _edgeWidth;
    107101    float _contourEdgeWidth;
    108     double _opacity;
    109102    double _warpScale;
    110103    double _dataScale;
     
    122115    vtkSmartPointer<vtkActor> _dsActor;
    123116    vtkSmartPointer<vtkActor> _contourActor;
    124     vtkSmartPointer<vtkPropAssembly> _props;
    125117};
    126118
  • trunk/packages/vizservers/vtkvis/RpLIC.cpp

    r2320 r2328  
    2626
    2727LIC::LIC() :
    28     _dataSet(NULL),
    29     _edgeWidth(1.0f),
    30     _opacity(1.0),
    31     _lighting(false),
     28    VtkGraphicsObject(),
    3229    _sliceAxis(Z_AXIS)
    3330{
    34     _edgeColor[0] = 0.0f;
    35     _edgeColor[1] = 0.0f;
    36     _edgeColor[2] = 0.0f;
    3731}
    3832
    3933LIC::~LIC()
    4034{
    41 }
    42 
    43 /**
    44  * \brief Get the VTK Prop for the LIC
    45  */
    46 vtkProp *LIC::getProp()
    47 {
    48     return _prop;
    4935}
    5036
     
    5339    if (_prop == NULL) {
    5440        _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);
    6047        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    }
    8450}
    8551
     
    224190
    225191    initProp();
    226     _prop->SetMapper(_mapper);
     192    getActor()->SetMapper(_mapper);
    227193
    228194    _mapper->Update();
     
    369335
    370336/**
    371  * \brief Turn on/off rendering of this LIC
    372  */
    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 LIC
    382  *
    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 LIC
    396  */
    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 LIC
    407  */
    408 double LIC::getOpacity()
    409 {
    410     return _opacity;
    411 }
    412 
    413 /**
    414  * \brief Turn on/off rendering of edges
    415  */
    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 edges
    425  */
    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 /**
    446337 * \brief Set a group of world coordinate planes to clip rendering
    447338 *
     
    454345    }
    455346}
    456 
    457 /**
    458  * \brief Turn on/off lighting of this object
    459  */
    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  
    1919#include <vtkLookupTable.h>
    2020
    21 #include "RpVtkDataSet.h"
     21#include "RpVtkGraphicsObject.h"
    2222
    2323namespace Rappture {
     
    2626/**
    2727 * \brief Line Integral Convolution visualization of vector fields
     28 *
     29 *  The DataSet must contain vectors
    2830 */
    29 class LIC {
     31class LIC : public VtkGraphicsObject {
    3032public:
    3133    enum Axis {
     
    3840    virtual ~LIC();
    3941
    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);
    4548
    4649    void selectVolumeSlice(Axis axis, double ratio);
     
    5053    vtkLookupTable *getLookupTable();
    5154
    52     void setOpacity(double opacity);
     55private:
     56    virtual void initProp();
     57    virtual void update();
    5358
    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;
    8059    Axis _sliceAxis;
    8160
    8261    vtkSmartPointer<vtkLookupTable> _lut;
    83     vtkSmartPointer<vtkActor> _prop;
    8462    vtkSmartPointer<vtkExtractVOI> _volumeSlicer;
    8563    vtkSmartPointer<vtkProbeFilter> _probeFilter;
  • trunk/packages/vizservers/vtkvis/RpMolecule.cpp

    r2320 r2328  
    2626
    2727Molecule::Molecule() :
    28     _dataSet(NULL),
    29     _edgeWidth(1.0),
    30     _opacity(1.0),
    31     _lighting(true),
     28    VtkGraphicsObject(),
    3229    _atomScaling(NO_ATOM_SCALING)
    3330{
    34     _edgeColor[0] = 0.0;
    35     _edgeColor[1] = 0.0;
    36     _edgeColor[2] = 0.0;
    3731}
    3832
     
    4539        TRACE("Deleting Molecule with NULL DataSet");
    4640#endif
    47 }
    48 
    49 /**
    50  * \brief Get the VTK Prop for the Molecule
    51  */
    52 vtkProp *Molecule::getProp()
    53 {
    54     return _props;
    5541}
    5642
     
    8066            _bondProp->GetProperty()->LightingOff();
    8167    }
    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    }
    10871}
    10972
     
    194157            _bondMapper->SetInputConnection(tuber->GetOutputPort());
    195158            _bondProp->SetMapper(_bondMapper);
    196             _props->AddPart(_bondProp);
     159            getAssembly()->AddPart(_bondProp);
    197160        }
    198161        if (pd->GetNumberOfVerts() > 0) {
     
    217180            _atomMapper->SetInputConnection(_glypher->GetOutputPort());
    218181            _atomProp->SetMapper(_atomMapper);
    219             _props->AddPart(_atomProp);
     182            getAssembly()->AddPart(_atomProp);
    220183        }
    221184    } else {
     
    259222
    260223/**
    261  * \brief Turn on/off rendering of this Molecule
    262  */
    263 void Molecule::setVisibility(bool state)
    264 {
    265     if (_props != NULL) {
    266         _props->SetVisibility((state ? 1 : 0));
    267     }
    268 }
    269 
    270 /**
    271224 * \brief Turn on/off rendering of the atoms
    272225 */
     
    286239        _bondProp->SetVisibility((state ? 1 : 0));
    287240    }
    288 }
    289 
    290 /**
    291  * \brief Get visibility state of the Molecule
    292  *
    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 Molecule
    306  */
    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 representations
    318  */
    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 edges
    343  */
    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 edges
    356  */
    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);
    378241}
    379242
     
    394257
    395258/**
    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 */
    407261void Molecule::setAtomScaling(AtomScaling state)
    408262{
  • trunk/packages/vizservers/vtkvis/RpMolecule.h

    r2320 r2328  
    1313#include <vtkPolyDataMapper.h>
    1414#include <vtkActor.h>
    15 #include <vtkPropAssembly.h>
     15#include <vtkAssembly.h>
    1616#include <vtkGlyph3D.h>
    1717
    1818#include "ColorMap.h"
    19 #include "RpVtkDataSet.h"
     19#include "RpVtkGraphicsObject.h"
    2020
    2121namespace Rappture {
     
    3333 * "element," it will be color-mapped as a standard scalar field.
    3434 */
    35 class Molecule {
     35class Molecule : public VtkGraphicsObject {
    3636public:
    3737    enum AtomScaling {
     
    4545    virtual ~Molecule();
    4646
    47     void setDataSet(DataSet *dataset);
     47    virtual const char *getClassName() const
     48    {
     49        return "Molecule";
     50    }
    4851
    49     DataSet *getDataSet();
    50 
    51     vtkProp *getProp();
     52    virtual void setClippingPlanes(vtkPlaneCollection *planes);
    5253
    5354    void setLookupTable(vtkLookupTable *lut);
     
    6162    void setBondVisibility(bool state);
    6263
    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 
    8164    static ColorMap *createElementColorMap();
    8265
    8366private:
    84     void initProp();
    85     void update();
     67    virtual void initProp();
     68    virtual void update();
    8669
    8770    static void addRadiusArray(vtkDataSet *dataSet, AtomScaling scaling);
    8871
    89     DataSet *_dataSet;
    90 
    91     float _edgeColor[3];
    92     float _edgeWidth;
    93     double _opacity;
    94     bool _lighting;
    9572    AtomScaling _atomScaling;
    9673
    9774    vtkSmartPointer<vtkLookupTable> _lut;
    98     vtkSmartPointer<vtkPropAssembly> _props;
    9975    vtkSmartPointer<vtkActor> _atomProp;
    10076    vtkSmartPointer<vtkActor> _bondProp;
  • trunk/packages/vizservers/vtkvis/RpPolyData.cpp

    r2320 r2328  
    2424
    2525PolyData::PolyData() :
    26     _dataSet(NULL),
    27     _edgeWidth(1.0),
    28     _opacity(1.0),
    29     _lighting(true)
     26    VtkGraphicsObject()
    3027{
    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;
    3731}
    3832
     
    4842
    4943/**
    50  * \brief Get the VTK Prop for the mesh
    51  */
    52 vtkProp *PolyData::getProp()
    53 {
    54     return _pdActor;
    55 }
    56 
    57 /**
    5844 * \brief Create and initialize a VTK Prop to render a mesh
    5945 */
    6046void PolyData::initProp()
    6147{
    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);
    7057        if (!_lighting)
    71             _pdActor->GetProperty()->LightingOff();
     58            property->LightingOff();
    7259    }
    73 }
    74 
    75 /**
    76  * \brief Specify input DataSet (PolyData)
    77  *
    78  * The DataSet must be a PolyData object
    79  */
    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 renders
    90  */
    91 DataSet *PolyData::getDataSet()
    92 {
    93     return _dataSet;
    9460}
    9561
     
    157123
    158124    initProp();
    159     _pdActor->SetMapper(_pdMapper);
     125    getActor()->SetMapper(_pdMapper);
    160126    _pdMapper->Update();
    161 }
    162 
    163 /**
    164  * \brief Turn on/off rendering of this mesh
    165  */
    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 mesh
    175  *
    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 mesh
    189  */
    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 representations
    199  */
    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 faces
    215  */
    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 edges
    227  */
    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 edges
    237  */
    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);
    255127}
    256128
     
    267139}
    268140
    269 /**
    270  * \brief Turn on/off lighting of this object
    271  */
    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  
    1313#include <vtkActor.h>
    1414
     15#include "RpVtkGraphicsObject.h"
    1516#include "RpVtkDataSet.h"
    1617
     
    2021/**
    2122 * \brief VTK Mesh (Polygon data)
     23 *
     24 * The DataSet must be a PolyData object
    2225 */
    23 class PolyData {
     26class PolyData : public VtkGraphicsObject {
    2427public:
    2528    PolyData();
    2629    virtual ~PolyData();
    2730
    28     void setDataSet(DataSet *dataset);
     31    virtual const char *getClassName() const
     32    {
     33        return "PolyData";
     34    }
    2935
    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);
    5337
    5438private:
    55     void initProp();
    56     void update();
     39    virtual void initProp();
     40    virtual void update();
    5741
    58     DataSet *_dataSet;
    59 
    60     float _color[3];
    61     float _edgeColor[3];
    62     float _edgeWidth;
    63     double _opacity;
    64     bool _lighting;
    6542    vtkSmartPointer<vtkPolyDataMapper> _pdMapper;
    66     vtkSmartPointer<vtkActor> _pdActor;
    6743};
    6844
  • trunk/packages/vizservers/vtkvis/RpPseudoColor.cpp

    r2320 r2328  
    2929
    3030PseudoColor::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{
    3933}
    4034
     
    5044
    5145/**
    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 */
     48void 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    }
    7061}
    7162
     
    170161
    171162    initProp();
    172     _dsActor->SetMapper(_dsMapper);
     163    getActor()->SetMapper(_dsMapper);
    173164    _dsMapper->Update();
    174 }
    175 
    176 /**
    177  * \brief Get the VTK Prop for the colormapped dataset
    178  */
    179 vtkProp *PseudoColor::getProp()
    180 {
    181     return _dsActor;
    182 }
    183 
    184 /**
    185  * \brief Create and initialize a VTK Prop to render the colormapped dataset
    186  */
    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     }
    199165}
    200166
     
    225191
    226192/**
    227  * \brief Turn on/off rendering of this colormapped dataset
    228  */
    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 dataset
    238  *
    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 dataset
    252  */
    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 representations
    262  */
    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 edges
    278  */
    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 edges
    288  */
    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 /**
    309193 * \brief Set a group of world coordinate planes to clip rendering
    310194 *
     
    317201    }
    318202}
    319 
    320 /**
    321  * \brief Turn on/off lighting of this object
    322  */
    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  
    1515#include <vtkPlaneCollection.h>
    1616
     17#include "RpVtkGraphicsObject.h"
    1718#include "RpVtkDataSet.h"
    1819
     
    2223/**
    2324 * \brief Color-mapped plot of data set
     25 *
     26 * Currently the DataSet must be image data (2D uniform grid)
    2427 */
    25 class PseudoColor {
     28class PseudoColor : public VtkGraphicsObject {
    2629public:
    2730    PseudoColor();
    2831    virtual ~PseudoColor();
    2932
    30     void setDataSet(DataSet *dataset);
     33    virtual const char *getClassName() const
     34    {
     35        return "PseudoColor";
     36    }
    3137
    32     DataSet *getDataSet();
    33 
    34     vtkProp *getProp();
     38    virtual void setClippingPlanes(vtkPlaneCollection *planes);
    3539
    3640    void setLookupTable(vtkLookupTable *lut);
     
    3842    vtkLookupTable *getLookupTable();
    3943
    40     void setVisibility(bool state);
     44private:
     45    virtual void initProp();
     46    virtual void update();
    4147
    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;
    6848    vtkSmartPointer<vtkLookupTable> _lut;
    6949    vtkSmartPointer<vtkDataSetMapper> _dsMapper;
    70     vtkSmartPointer<vtkActor> _dsActor;
    7150};
    7251
  • trunk/packages/vizservers/vtkvis/RpStreamlines.cpp

    r2319 r2328  
    2828
    2929Streamlines::Streamlines() :
    30     _dataSet(NULL),
     30    VtkGraphicsObject(),
    3131    _lineType(LINES),
    32     _edgeWidth(1.0f),
    33     _opacity(1.0),
    34     _lighting(false),
    3532    _seedVisible(true)
    3633{
    37     _edgeColor[0] = 0.0f;
    38     _edgeColor[1] = 0.0f;
    39     _edgeColor[2] = 0.0f;
    4034    _seedColor[0] = 1.0f;
    4135    _seedColor[1] = 1.0f;
     
    4842
    4943/**
    50  * \brief Get the VTK Prop for the Streamlines
    51  */
    52 vtkProp *Streamlines::getProp()
    53 {
    54     return _props;
    55 }
    56 
    57 /**
    5844 * \brief Create and initialize a VTK Prop to render Streamlines
    5945 */
    6046void Streamlines::initProp()
    6147{
    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);
    6854        if (!_lighting)
    69             _prop->GetProperty()->LightingOff();
     55            _linesActor->GetProperty()->LightingOff();
    7056        switch (_lineType) {
    7157        case LINES:
    72             _prop->GetProperty()->SetRepresentationToWireframe();
    73             _prop->GetProperty()->EdgeVisibilityOff();
     58            _linesActor->GetProperty()->SetRepresentationToWireframe();
     59            _linesActor->GetProperty()->EdgeVisibilityOff();
    7460            break;
    7561        case TUBES:
    76             _prop->GetProperty()->SetRepresentationToSurface();
    77             _prop->GetProperty()->EdgeVisibilityOff();
     62            _linesActor->GetProperty()->SetRepresentationToSurface();
     63            _linesActor->GetProperty()->EdgeVisibilityOff();
    7864            break;
    7965        case RIBBONS:
    80             _prop->GetProperty()->SetRepresentationToSurface();
    81             _prop->GetProperty()->EdgeVisibilityOff();
     66            _linesActor->GetProperty()->SetRepresentationToSurface();
     67            _linesActor->GetProperty()->EdgeVisibilityOff();
    8268            break;
    8369        default:
     
    9480        _seedActor->GetProperty()->LightingOff();
    9581    }
    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    }
    12287}
    12388
     
    284249    _pdMapper->SetLookupTable(_lut);
    285250
    286     _prop->SetMapper(_pdMapper);
     251    _linesActor->SetMapper(_pdMapper);
    287252    _pdMapper->Update();
    288253    _seedMapper->Update();
     
    442407        _pdMapper->SetInputConnection(_streamTracer->GetOutputPort());
    443408        _lineFilter = NULL;
    444         _prop->GetProperty()->SetRepresentationToWireframe();
    445         _prop->GetProperty()->LightingOff();
     409        _linesActor->GetProperty()->SetRepresentationToWireframe();
     410        _linesActor->GetProperty()->LightingOff();
    446411    }
    447412}
     
    468433        tubeFilter->SetRadius(radius);
    469434        _pdMapper->SetInputConnection(_lineFilter->GetOutputPort());
    470         _prop->GetProperty()->SetRepresentationToSurface();
    471         _prop->GetProperty()->LightingOn();
     435        _linesActor->GetProperty()->SetRepresentationToSurface();
     436        _linesActor->GetProperty()->LightingOn();
    472437     }
    473438}
     
    493458        ribbonFilter->UseDefaultNormalOn();
    494459        _pdMapper->SetInputConnection(_lineFilter->GetOutputPort());
    495         _prop->GetProperty()->SetRepresentationToSurface();
    496         _prop->GetProperty()->LightingOn();
     460        _linesActor->GetProperty()->SetRepresentationToSurface();
     461        _linesActor->GetProperty()->LightingOn();
    497462    }
    498463}
     
    523488
    524489/**
     490 * \brief Turn on/off lighting of this object
     491 */
     492void Streamlines::setLighting(bool state)
     493{
     494    _lighting = state;
     495    if (_linesActor != NULL)
     496        _linesActor->GetProperty()->SetLighting((state ? 1 : 0));
     497}
     498
     499/**
    525500 * \brief Turn on/off rendering of this Streamlines
    526501 */
    527502void Streamlines::setVisibility(bool state)
    528503{
    529     if (_prop != NULL) {
    530         _prop->SetVisibility((state ? 1 : 0));
     504    if (_linesActor != NULL) {
     505        _linesActor->SetVisibility((state ? 1 : 0));
    531506    }
    532507    if (_seedActor != NULL) {
     
    556531bool Streamlines::getVisibility()
    557532{
    558     if (_prop == NULL) {
     533    if (_linesActor == NULL) {
    559534        return false;
    560535    } 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    }
    585538}
    586539
     
    590543void Streamlines::setEdgeVisibility(bool state)
    591544{
    592     if (_prop != NULL) {
    593         _prop->GetProperty()->SetEdgeVisibility((state ? 1 : 0));
     545    if (_linesActor != NULL) {
     546        _linesActor->GetProperty()->SetEdgeVisibility((state ? 1 : 0));
    594547    }
    595548}
     
    603556    _edgeColor[1] = color[1];
    604557    _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]);
    607560}
    608561
     
    625578{
    626579    _edgeWidth = edgeWidth;
    627     if (_prop != NULL)
    628         _prop->GetProperty()->SetLineWidth(_edgeWidth);
     580    if (_linesActor != NULL)
     581        _linesActor->GetProperty()->SetLineWidth(_edgeWidth);
    629582}
    630583
     
    643596    }
    644597}
    645 
    646 /**
    647  * \brief Turn on/off lighting of this object
    648  */
    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  
    1616#include <vtkPolyDataMapper.h>
    1717#include <vtkLookupTable.h>
    18 #include <vtkPropAssembly.h>
     18#include <vtkAssembly.h>
    1919
    20 #include "RpVtkDataSet.h"
     20#include "RpVtkGraphicsObject.h"
    2121
    2222namespace Rappture {
     
    2525/**
    2626 * \brief Streamline visualization of vector fields
     27 *
     28 * The DataSet must contain vectors
    2729 */
    28 class Streamlines {
     30class Streamlines : public VtkGraphicsObject {
    2931public:
    3032    enum LineType {
     
    3739    virtual ~Streamlines();
    3840
    39     void setDataSet(DataSet *dataset);
     41    virtual const char *getClassName() const
     42    {
     43        return "Streamlines";
     44    }
    4045
    41     DataSet *getDataSet();
     46    virtual void setLighting(bool state);
     47   
     48    virtual void setVisibility(bool state);
    4249
    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);
    4459
    4560    void setSeedToRandomPoints(int numPoints);
     
    6277    vtkLookupTable *getLookupTable();
    6378
    64     void setOpacity(double opacity);
    65 
    66     double getOpacity();
    67 
    68     void setVisibility(bool state);
    69 
    7079    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);
    7980
    8081    void setSeedColor(float color[3]);
    8182
    82     void setClippingPlanes(vtkPlaneCollection *planes);
    83 
    84     void setLighting(bool state);
    85 
    8683private:
    87     void initProp();
    88     void update();
     84    virtual void initProp();
     85    virtual void update();
    8986
    9087    static void getRandomPoint(double pt[3], const double bounds[6]);
    9188    static void getRandomCellPt(vtkDataSet *ds, double pt[3]);
    9289
    93     DataSet *_dataSet;
    94 
    9590    LineType _lineType;
    96     float _edgeColor[3];
    97     float _edgeWidth;
    9891    float _seedColor[3];
    99     double _opacity;
    100     bool _lighting;
    10192    bool _seedVisible;
    10293
    10394    vtkSmartPointer<vtkLookupTable> _lut;
    104     vtkSmartPointer<vtkActor> _prop;
     95    vtkSmartPointer<vtkActor> _linesActor;
    10596    vtkSmartPointer<vtkActor> _seedActor;
    106     vtkSmartPointer<vtkPropAssembly> _props;
    10797    vtkSmartPointer<vtkStreamTracer> _streamTracer;
    10898    vtkSmartPointer<vtkPolyDataAlgorithm> _lineFilter;
  • trunk/packages/vizservers/vtkvis/RpVolume.cpp

    r2320 r2328  
    2727
    2828Volume::Volume() :
    29     _dataSet(NULL),
    30     _opacity(1.0),
     29    VtkGraphicsObject(),
    3130    _colorMap(NULL)
    3231{
     
    4443
    4544/**
    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
    5046 */
    51 void Volume::setDataSet(DataSet *dataSet)
     47void Volume::initProp()
    5248{
    53     if (_dataSet != dataSet) {
    54         _dataSet = dataSet;
    55         update();
     49    if (_prop == NULL) {
     50        _prop = vtkSmartPointer<vtkVolume>::New();
     51        getVolume()->GetProperty()->SetInterpolationTypeToLinear();
    5652    }
    57 }
    58 
    59 /**
    60  * \brief Returns the DataSet this Volume renders
    61  */
    62 DataSet *Volume::getDataSet()
    63 {
    64     return _dataSet;
    6553}
    6654
     
    129117    }
    130118
    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));
    133122
    134     _volumeProp->SetMapper(_volumeMapper);
     123    getVolume()->SetMapper(_volumeMapper);
    135124    _volumeMapper->Update();
    136 }
    137 
    138 /**
    139  * \brief Get the VTK Prop for the Volume
    140  */
    141 vtkProp *Volume::getProp()
    142 {
    143     return _volumeProp;
    144 }
    145 
    146 /**
    147  * \brief Create and initialize a VTK Prop to render the Volume
    148  */
    149 void Volume::initProp()
    150 {
    151     if (_volumeProp == NULL) {
    152         _volumeProp = vtkSmartPointer<vtkVolume>::New();
    153         _volumeProp->GetProperty()->SetInterpolationTypeToLinear();
    154     }
    155125}
    156126
     
    161131{
    162132    _colorMap = cmap;
    163     if (_volumeProp != NULL) {
     133    if (getVolume() != NULL) {
    164134        double dataRange[2];
    165135        _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));
    168138    }
    169139}
     
    176146{
    177147    _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));
    181151    }
    182152}
     
    199169    // across the different mappers/algorithms.  This only works with the
    200170    // 3D texture mapper, not the GPU raycast mapper
    201     if (_volumeProp != NULL) {
     171    if (getVolume() != NULL) {
    202172        if (opacity < 1.0e-6)
    203173            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);
    229175    }
    230176}
     
    241187    }
    242188}
    243 
    244 /**
    245  * \brief Set the ambient lighting/shading coefficient
    246  */
    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 coefficient
    256  */
    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 power
    266  */
    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 object
    277  */
    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  
    1515#include <vtkPlaneCollection.h>
    1616
    17 #include "RpVtkDataSet.h"
     17#include "RpVtkGraphicsObject.h"
    1818#include "ColorMap.h"
    1919
     
    2323/**
    2424 * \brief Volume Rendering
     25 *
     26 * Currently the DataSet must be image data (3D uniform grid),
     27 * or an UnstructuredGrid
    2528 */
    26 class Volume {
     29class Volume : public VtkGraphicsObject {
    2730public:
    2831    enum BlendMode {
     
    3538    virtual ~Volume();
    3639
    37     void setDataSet(DataSet *dataset);
     40    virtual const char *getClassName() const
     41    {
     42        return "Volume";
     43    }
    3844
    39     DataSet *getDataSet();
     45    virtual void setOpacity(double opacity);
    4046
    41     vtkProp *getProp();
     47    virtual void setClippingPlanes(vtkPlaneCollection *planes);
    4248
    4349    void setColorMap(ColorMap *cmap);
     50
    4451    void setColorMap(ColorMap *cmap, double dataRange[2]);
    4552
    4653    ColorMap *getColorMap();
    4754
    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 
    6455private:
    65     void initProp();
    66     void update();
    67 
    68     DataSet *_dataSet;
    69     double _opacity;
     56    virtual void initProp();
     57    virtual void update();
    7058
    7159    ColorMap *_colorMap;
    72     vtkSmartPointer<vtkVolume> _volumeProp;
    7360    vtkSmartPointer<vtkAbstractVolumeMapper> _volumeMapper;
    7461};
  • trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp

    r2320 r2328  
    853853
    854854/**
     855 * \brief Turn on/off rendering of all axes
     856 */
     857void 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/**
    855873 * \brief Turn on/off rendering of all axes gridlines
    856874 */
    857875void Renderer::setAxesGridVisibility(bool state)
    858876{
     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 */
     885void 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 */
     895void 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 */
     905void Renderer::setAxisVisibility(Axis axis, bool state)
     906{
    859907    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        }
    863923        _needsRedraw = true;
    864924    }
     
    883943
    884944/**
    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 */
     947void Renderer::setAxisLabelVisibility(Axis axis, bool state)
    906948{
    907949    if (_cubeAxesActor != NULL) {
    908950        if (axis == X_AXIS) {
    909             _cubeAxesActor->SetXAxisVisibility((state ? 1 : 0));
     951            _cubeAxesActor->SetXAxisLabelVisibility((state ? 1 : 0));
    910952        } else if (axis == Y_AXIS) {
    911             _cubeAxesActor->SetYAxisVisibility((state ? 1 : 0));
     953            _cubeAxesActor->SetYAxisLabelVisibility((state ? 1 : 0));
    912954        } else if (axis == Z_AXIS) {
    913             _cubeAxesActor->SetZAxisVisibility((state ? 1 : 0));
     955            _cubeAxesActor->SetZAxisLabelVisibility((state ? 1 : 0));
    914956        }
    915957        _needsRedraw = true;
     
    917959    if (_cubeAxesActor2D != NULL) {
    918960        if (axis == X_AXIS) {
    919             _cubeAxesActor2D->SetXAxisVisibility((state ? 1 : 0));
     961            _cubeAxesActor2D->GetXAxisActor2D()->SetLabelVisibility((state ? 1 : 0));
    920962        } 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 */
     972void 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));
    922989        }
    923990        _needsRedraw = true;
     
    20332100
    20342101/**
     2102 * \brief Turn on/off wireframe rendering of Glyphs for the given DataSet
     2103 */
     2104void 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/**
    20352129 * \brief Turn Glyphs lighting on/off for the specified DataSet
    20362130 */
     
    21302224
    21312225/**
     2226 * \brief Set an additional transform on the prop
     2227 */
     2228void 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 */
     2256void 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 */
     2284void 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 */
     2312void 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 */
     2340void 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/**
    21322366 * \brief Set the volume slice used for mapping volumetric data
    21332367 */
     
    29073141
    29083142/**
     3143 * \brief Set the prop orientation with a quaternion
     3144 */
     3145void 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 */
     3173void 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 */
     3201void 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 */
     3229void 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 */
     3257void 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/**
    29093283 * \brief Associate an existing named color map with a Molecule for the given DataSet
    29103284 */
     
    32863660    } else
    32873661        return itr->second;
     3662}
     3663
     3664/**
     3665 * \brief Set an additional transform on the prop
     3666 */
     3667void 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 */
     3695void 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 */
     3723void 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 */
     3751void 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 */
     3779void 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;
    32883802}
    32893803
     
    58406354
    58416355/**
     6356 * \brief Sets flag to trigger rendering next time render() is called
     6357 */
     6358void Renderer::eventuallyRender()
     6359{
     6360    _needsRedraw = true;
     6361}
     6362
     6363/**
    58426364 * \brief Cause the rendering to render a new image if needed
    58436365 *
  • trunk/packages/vizservers/vtkvis/RpVtkRenderer.h

    r2320 r2328  
    114114    // Render window
    115115
     116    /// Get the VTK render window object this Renderer uses
    116117    vtkRenderWindow *getRenderWindow()
    117118    {
     
    167168    void setUseDepthPeeling(bool state);
    168169
     170    void eventuallyRender();
     171
    169172    bool render();
    170173
     
    175178    void setAxesFlyMode(AxesFlyMode mode);
    176179
     180    void setAxesVisibility(bool state);
     181
    177182    void setAxesGridVisibility(bool state);
    178183
    179     void setAxesVisibility(bool state);
     184    void setAxesLabelVisibility(bool state);
     185
     186    void setAxesTickVisibility(bool state);
    180187
    181188    void setAxesColor(double color[3]);
    182189
     190    void setAxisVisibility(Axis axis, bool state);
     191
    183192    void setAxisGridVisibility(Axis axis, bool state);
    184193
    185     void setAxisVisibility(Axis axis, bool state);
     194    void setAxisLabelVisibility(Axis axis, bool state);
     195
     196    void setAxisTickVisibility(Axis axis, bool state);
    186197
    187198    void setAxisTitle(Axis axis, const char *title);
     
    211222    Contour2D *getContour2D(const DataSetId& id);
    212223
     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
    213234    void setContour2DContours(const DataSetId& id, int numContours);
    214235
    215236    void setContour2DContourList(const DataSetId& id, const std::vector<double>& contours);
    216237
    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 
    227238    // 3D Contour (isosurface) plots
    228239
     
    233244    Contour3D *getContour3D(const DataSetId& id);
    234245
     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
    235262    void setContour3DContours(const DataSetId& id, int numContours);
    236263
     
    239266    void setContour3DColorMap(const DataSetId& id, const ColorMapId& colorMapId);
    240267
    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 
    257268    // Glyphs
    258269
     
    263274    Glyphs *getGlyphs(const DataSetId& id);
    264275
     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
    265284    void setGlyphsColorMap(const DataSetId& id, const ColorMapId& colorMapId);
    266285
     
    269288    void setGlyphsScaleFactor(const DataSetId& id, double scale);
    270289
    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 
    277290    // Height maps
    278291
     
    283296    HeightMap *getHeightMap(const DataSetId& id);
    284297
     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
    285320    void setHeightMapVolumeSlice(const DataSetId& id, HeightMap::Axis axis, double ratio);
    286321
     
    293328    void setHeightMapContourList(const DataSetId& id, const std::vector<double>& contours);
    294329
    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 
    305330    void setHeightMapContourVisibility(const DataSetId& id, bool state);
    306331
     
    309334    void setHeightMapContourEdgeWidth(const DataSetId& id, float edgeWidth);
    310335
    311     void setHeightMapLighting(const DataSetId& id, bool state);
    312 
    313336    // LIC plots
    314337
     
    319342    LIC *getLIC(const DataSetId& id);
    320343
     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
    321356    void setLICVolumeSlice(const DataSetId& id, LIC::Axis axis, double ratio);
    322357
    323358    void setLICColorMap(const DataSetId& id, const ColorMapId& colorMapId);
    324359
    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 
    337360    // Molecules
    338361
     
    343366    Molecule *getMolecule(const DataSetId& id);
    344367
     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
    345392    void setMoleculeColorMap(const DataSetId& id, const ColorMapId& colorMapId);
    346393
    347     void setMoleculeOpacity(const DataSetId& id, double opacity);
    348 
    349394    void setMoleculeAtomScaling(const DataSetId& id, Molecule::AtomScaling scaling);
    350395
     
    353398    void setMoleculeBondVisibility(const DataSetId& id, bool state);
    354399
    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 
    367400    // PolyData Meshes
    368401
     
    373406    PolyData *getPolyData(const DataSetId& id);
    374407
     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
    375428    void setPolyDataOpacity(const DataSetId& id, double opacity);
    376429
    377430    void setPolyDataVisibility(const DataSetId& id, bool state);
    378431
    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 
    387432    void setPolyDataWireframe(const DataSetId& id, bool state);
    388433
    389     void setPolyDataLighting(const DataSetId& id, bool state);
    390434
    391435    // Color-mapped surfaces
     
    396440
    397441    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);
    398456
    399457    void setPseudoColorColorMap(const DataSetId& id, const ColorMapId& colorMapId);
    400458
    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 
    415459    // Streamlines
    416460
     
    420464
    421465    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);
    422478
    423479    void setStreamlinesSeedToRandomPoints(const DataSetId& id, int numPoints);
     
    436492    void setStreamlinesTypeToRibbons(const DataSetId& id, double width, double angle);
    437493
    438     void setStreamlinesOpacity(const DataSetId& id, double opacity);
    439 
    440     void setStreamlinesVisibility(const DataSetId& id, bool state);
    441 
    442494    void setStreamlinesSeedVisibility(const DataSetId& id, bool state);
    443495
     
    446498    void setStreamlinesSeedColor(const DataSetId& id, float color[3]);
    447499
    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 
    456500    // Volumes
    457501
     
    461505
    462506    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);
    463519
    464520    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);
    477521
    478522private:
  • trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp

    r2320 r2328  
    126126
    127127static int
     128AxisLabelsVisibleOp(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
     153static int
    128154AxisNameOp(ClientData clientData, Tcl_Interp *interp, int objc,
    129155           Tcl_Obj *const *objv)
     
    141167        Tcl_AppendResult(interp, "bad axis option \"", string,
    142168                         "\": should be axisName title", (char*)NULL);
     169        return TCL_ERROR;
     170    }
     171    return TCL_OK;
     172}
     173
     174static int
     175AxisTicksVisibleOp(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);
    143195        return TCL_ERROR;
    144196    }
     
    197249    {"flymode", 1, AxisFlyModeOp, 3, 3, "mode"},
    198250    {"grid",    1, AxisGridOp, 4, 4, "axis bool"},
     251    {"labels",  1, AxisLabelsVisibleOp, 4, 4, "axis bool"},
    199252    {"name",    1, AxisNameOp, 4, 4, "axis title"},
     253    {"ticks",   1, AxisTicksVisibleOp, 4, 4, "axis bool"},
    200254    {"units",   1, AxisUnitsOp, 4, 4, "axis units"},
    201255    {"visible", 1, AxisVisibleOp, 4, 4, "axis bool"}
     
    13831437}
    13841438
     1439static int
     1440GlyphsWireframeOp(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
    13851456static 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?"}
    13941466};
    13951467static int nGlyphsOps = NumCmdSpecs(glyphsOps);
     
    16601732    } else {
    16611733        g_renderer->setHeightMapOpacity("all", opacity);
     1734    }
     1735    return TCL_OK;
     1736}
     1737
     1738static int
     1739HeightMapOrientOp(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
     1758static int
     1759HeightMapPositionOp(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
     1777static int
     1778HeightMapScaleOp(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);
    16621792    }
    16631793    return TCL_OK;
     
    17241854    {"linecolor",    5, HeightMapLineColorOp, 5, 6, "r g b ?dataSetName?"},
    17251855    {"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?"},
    17271860    {"visible",      2, HeightMapVisibleOp, 3, 4, "bool ?dataSetName?"},
    17281861    {"volumeslice",  2, HeightMapVolumeSliceOp, 4, 5, "axis ratio ?dataSetName?"}
     
    21902323
    21912324static int
     2325MoleculeOrientOp(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
     2344static int
     2345MoleculePositionOp(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
     2363static int
     2364MoleculeScaleOp(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
     2382static int
    21922383MoleculeVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc,
    21932384                  Tcl_Obj *const *objv)
     
    22332424    {"linecolor",  5, MoleculeLineColorOp, 5, 6, "r g b ?dataSetName?"},
    22342425    {"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?"},
    22372431    {"visible",    1, MoleculeVisibleOp, 3, 4, "bool ?dataSetName?"},
    22382432    {"wireframe",  1, MoleculeWireframeOp, 3, 4, "bool ?dataSetName?"}
     
    23852579    return TCL_OK;
    23862580}
     2581
     2582static int
     2583PolyDataOrientOp(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
     2602static int
     2603PolyDataPositionOp(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
     2621static int
     2622PolyDataScaleOp(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
    23872640
    23882641static int
     
    24282681    {"linecolor", 5, PolyDataLineColorOp, 5, 6, "r g b ?dataSetName?"},
    24292682    {"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?"},
    24312687    {"visible",   1, PolyDataVisibleOp, 3, 4, "bool ?dataSetName?"},
    24322688    {"wireframe", 1, PolyDataWireframeOp, 3, 4, "bool ?dataSetName?"}
     
    26792935}
    26802936
     2937static int
     2938RendererRenderOp(ClientData clientData, Tcl_Interp *interp, int objc,
     2939                 Tcl_Obj *const *objv)
     2940{
     2941    g_renderer->eventuallyRender();
     2942    return TCL_OK;
     2943}
     2944
    26812945static Rappture::CmdSpec rendererOps[] = {
    26822946    {"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, ""}
    26842949};
    26852950static int nRendererOps = NumCmdSpecs(rendererOps);
  • trunk/packages/vizservers/vtkvis/protocol.txt

    r2320 r2328  
    2121     <mode> = static_edges|static_triad|outer_edges|furthest_triad|closest_triad
    2222axis grid <bool>
     23axis labels <axis> <bool>
     24     Toggle visibility of axis labels
     25     <axis> = x|y|z|all
    2326axis name <axis> <title>
     27axis ticks <axis> <bool>
     28     Toggle visibility of axis tick marks
     29     <axis> = x|y|z|all
    2430axis units <axis> <units>
    2531     Currently only supported when camera mode is not image mode
     
    106112glyphs shape <arrow|cone|cube|cylinder|dodecahedron|icosahedron|octahedron|sphere|tetrahedron> <?datasetName?>
    107113glyphs visible <bool> <?datasetName?>
     114glyphs wireframe <bool> <?datasetName?>
    108115
    109116heightmap add numcontours <n> <?dataSetName?>
     
    123130heightmap linewidth <width> <?dataSetName?>
    124131heightmap opacity <value> <?dataSetName?>
     132heightmap orient <qw> <qx> <qy> <qz> <?dataSetName?>
     133heightmap pos <x> <y> <z> <?dataSetName?>
     134heightmap scale <sx> <sy> <sz> <?dataSetName?>
    125135heightmap visible <bool> <?dataSetName?>
    126136heightmap volumeslice axis ratio <?dataSetName?>
     
    151161molecule linewidth <val> <?datasetName?>
    152162molecule opacity <val> <?datasetName?>
    153 molecule scaleatoms <val> <?dataSetName?>
     163molecule orient <qw> <qx> <qy> <qz> <?dataSetName?>
     164molecule pos <x> <y> <z> <?dataSetName?>
     165molecule rscale <val> <?dataSetName?>
     166         Atom radius scaling
    154167         val = van_der_walls|covalent|atomic|none
     168molecule scale <sx> <sy> <sz> <?dataSetName?>
    155169molecule visible <bool> <?datasetName?>
    156170molecule wireframe <bool> <?datasetName?>
     
    164178polydata linewidth <val> <?datasetName?>
    165179polydata opacity <val> <?datasetName?>
     180polydata orient <qw> <qx> <qy> <qz> <?dataSetName?>
     181polydata pos <x> <y> <z> <?dataSetName?>
     182polydata scale <sx> <sy> <sz> <?dataSetName?>
    166183polydata visible <bool> <?datasetName?>
    167184polydata wireframe <bool> <?datasetName?>
Note: See TracChangeset for help on using the changeset viewer.