Ignore:
Timestamp:
Mar 30, 2011, 12:34:02 PM (13 years ago)
Author:
gah
Message:
 
Location:
branches/blt4/packages/vizservers
Files:
2 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • branches/blt4/packages/vizservers/configure.in

    r2120 r2170  
    315315  LD_RPATH="$loader_run_path:${CG_DIR}/lib"
    316316fi
    317 AC_SUBST(LIBS)
     317
    318318AC_SUBST(CG_DIR)
    319319AC_MSG_RESULT([${CG_DIR}])
  • branches/blt4/packages/vizservers/vtkvis/CmdProc.cpp

    r2120 r2170  
    2222 */
    2323static int
    24 BinaryOpSearch(
    25     Rappture::CmdSpec *specs,
    26     int nSpecs,
    27     char *string)       /* Name of minor operation to search for */
     24BinaryOpSearch(Rappture::CmdSpec *specs,
     25               int nSpecs,
     26               char *string)       /* Name of minor operation to search for */
    2827{
    2928    char c;
     
    7776 */
    7877static int
    79 LinearOpSearch(
    80     Rappture::CmdSpec *specs,
    81     int nSpecs,
    82     char *string)       /* Name of minor operation to search for */
     78LinearOpSearch(Rappture::CmdSpec *specs,
     79               int nSpecs,
     80               char *string)       /* Name of minor operation to search for */
    8381{
    8482    Rappture::CmdSpec *specPtr;
     
    9391    last = -1;
    9492    for (specPtr = specs, i = 0; i < nSpecs; i++, specPtr++) {
    95     if ((c == specPtr->name[0]) &&
    96         (strncmp(string, specPtr->name, length) == 0)) {
    97         last = i;
    98         nMatches++;
    99         if ((int)length == specPtr->minChars) {
    100         break;
    101         }
    102     }
     93        if ((c == specPtr->name[0]) &&
     94            (strncmp(string, specPtr->name, length) == 0)) {
     95            last = i;
     96            nMatches++;
     97            if ((int)length == specPtr->minChars) {
     98                break;
     99            }
     100        }
    103101    }
    104102    if (nMatches > 1) {
    105     return -2;      /* Ambiguous operation name */
     103        return -2;      /* Ambiguous operation name */
    106104    }
    107105    if (nMatches == 0) {
    108     return -1;      /* Can't find operation */
     106        return -1;      /* Can't find operation */
    109107    }
    110108    return last;        /* Op found. */
     
    122120 */
    123121Tcl_ObjCmdProc *
    124 Rappture::GetOpFromObj(
    125     Tcl_Interp *interp,                 /* Interpreter to report errors to */
    126     int nSpecs,                         /* Number of specifications in array */
    127     Rappture::CmdSpec *specs,           /* Op specification array */
    128     int operPos,                        /* Position of operation in argument
    129                                          * list. */
    130     int objc,                           /* Number of arguments in the argument
    131                                          * vector.  This includes any prefixed
    132                                          * arguments */
    133     Tcl_Obj *const *objv,               /* Argument vector */
    134     int flags)
     122Rappture::GetOpFromObj(Tcl_Interp *interp,              /* Interpreter to report errors to */
     123                       int nSpecs,                      /* Number of specifications in array */
     124                       Rappture::CmdSpec *specs,        /* Op specification array */
     125                       int operPos,                     /* Position of operation in argument
     126                                                         * list. */
     127                       int objc,                        /* Number of arguments in the argument
     128                                                         * vector.  This includes any prefixed
     129                                                         * arguments */
     130                       Tcl_Obj *const *objv,            /* Argument vector */
     131                       int flags)
    135132{
    136133    CmdSpec *specPtr;
     
    139136
    140137    if (objc <= operPos) {  /* No operation argument */
    141     Tcl_AppendResult(interp, "wrong # args: ", (char *)NULL);
    142       usage:
    143     Tcl_AppendResult(interp, "should be one of...", (char *)NULL);
    144     for (n = 0; n < nSpecs; n++) {
    145         int i;
    146 
    147         Tcl_AppendResult(interp, "\n  ", (char *)NULL);
    148         for (i = 0; i < operPos; i++) {
    149         Tcl_AppendResult(interp, Tcl_GetString(objv[i]), " ",
    150              (char *)NULL);
    151         }
    152         specPtr = specs + n;
    153         Tcl_AppendResult(interp, specPtr->name, " ", specPtr->usage,
    154         (char *)NULL);
    155     }
    156     return NULL;
     138        Tcl_AppendResult(interp, "wrong # args: ", (char *)NULL);
     139usage:
     140        Tcl_AppendResult(interp, "should be one of...", (char *)NULL);
     141        for (n = 0; n < nSpecs; n++) {
     142            int i;
     143
     144            Tcl_AppendResult(interp, "\n  ", (char *)NULL);
     145            for (i = 0; i < operPos; i++) {
     146                Tcl_AppendResult(interp, Tcl_GetString(objv[i]), " ",
     147                                 (char *)NULL);
     148            }
     149            specPtr = specs + n;
     150            Tcl_AppendResult(interp, specPtr->name, " ", specPtr->usage,
     151                             (char *)NULL);
     152        }
     153        return NULL;
    157154    }
    158155    string = Tcl_GetString(objv[operPos]);
    159156    if (flags & CMDSPEC_LINEAR_SEARCH) {
    160     n = LinearOpSearch(specs, nSpecs, string);
     157        n = LinearOpSearch(specs, nSpecs, string);
    161158    } else {
    162     n = BinaryOpSearch(specs, nSpecs, string);
     159        n = BinaryOpSearch(specs, nSpecs, string);
    163160    }
    164161    if (n == -2) {
    165     char c;
    166     size_t length;
    167 
    168     Tcl_AppendResult(interp, "ambiguous", (char *)NULL);
    169     if (operPos > 2) {
    170         Tcl_AppendResult(interp, " ", Tcl_GetString(objv[operPos - 1]),
    171         (char *)NULL);
    172     }
    173     Tcl_AppendResult(interp, " operation \"", string, "\" matches: ",
    174         (char *)NULL);
    175 
    176     c = string[0];
    177     length = strlen(string);
    178     for (n = 0; n < nSpecs; n++) {
    179         specPtr = specs + n;
    180         if ((c == specPtr->name[0]) &&
    181         (strncmp(string, specPtr->name, length) == 0)) {
    182         Tcl_AppendResult(interp, " ", specPtr->name, (char *)NULL);
    183         }
    184     }
    185     return NULL;
     162        char c;
     163        size_t length;
     164
     165        Tcl_AppendResult(interp, "ambiguous", (char *)NULL);
     166        if (operPos > 2) {
     167            Tcl_AppendResult(interp, " ", Tcl_GetString(objv[operPos - 1]),
     168                             (char *)NULL);
     169        }
     170        Tcl_AppendResult(interp, " operation \"", string, "\" matches: ",
     171                         (char *)NULL);
     172
     173        c = string[0];
     174        length = strlen(string);
     175        for (n = 0; n < nSpecs; n++) {
     176            specPtr = specs + n;
     177            if ((c == specPtr->name[0]) &&
     178                (strncmp(string, specPtr->name, length) == 0)) {
     179                Tcl_AppendResult(interp, " ", specPtr->name, (char *)NULL);
     180            }
     181        }
     182        return NULL;
    186183
    187184    } else if (n == -1) {   /* Can't find operation, display help */
    188     Tcl_AppendResult(interp, "bad", (char *)NULL);
    189     if (operPos > 2) {
    190         Tcl_AppendResult(interp, " ", Tcl_GetString(objv[operPos - 1]),
    191         (char *)NULL);
    192     }
    193     Tcl_AppendResult(interp, " operation \"", string, "\": ", (char *)NULL);
    194     goto usage;
     185        Tcl_AppendResult(interp, "bad", (char *)NULL);
     186        if (operPos > 2) {
     187            Tcl_AppendResult(interp, " ", Tcl_GetString(objv[operPos - 1]),
     188                             (char *)NULL);
     189        }
     190        Tcl_AppendResult(interp, " operation \"", string, "\": ", (char *)NULL);
     191        goto usage;
    195192    }
    196193    specPtr = specs + n;
    197194    if ((objc < specPtr->minArgs) ||
    198     ((specPtr->maxArgs > 0) && (objc > specPtr->maxArgs))) {
    199     int i;
    200 
    201     Tcl_AppendResult(interp, "wrong # args: should be \"", (char *)NULL);
    202     for (i = 0; i < operPos; i++) {
    203         Tcl_AppendResult(interp, Tcl_GetString(objv[i]), " ",
    204         (char *)NULL);
    205     }
    206     Tcl_AppendResult(interp, specPtr->name, " ", specPtr->usage, "\"",
    207         (char *)NULL);
    208     return NULL;
     195        ((specPtr->maxArgs > 0) && (objc > specPtr->maxArgs))) {
     196        int i;
     197
     198        Tcl_AppendResult(interp, "wrong # args: should be \"", (char *)NULL);
     199        for (i = 0; i < operPos; i++) {
     200            Tcl_AppendResult(interp, Tcl_GetString(objv[i]), " ",
     201                             (char *)NULL);
     202        }
     203        Tcl_AppendResult(interp, specPtr->name, " ", specPtr->usage, "\"",
     204                         (char *)NULL);
     205        return NULL;
    209206    }
    210207    return specPtr->proc;
  • branches/blt4/packages/vizservers/vtkvis/CmdProc.h

    r2120 r2170  
    2020 */
    2121typedef struct {
    22     const char *name;           /* Name of operation */
    23     int minChars;               /* Minimum # characters to disambiguate */
     22    const char *name;           /**< Name of operation */
     23    int minChars;               /**< Minimum # characters to disambiguate */
    2424    Tcl_ObjCmdProc *proc;
    25     int minArgs;                /* Minimum # args required */
    26     int maxArgs;                /* Maximum # args required */
    27     const char *usage;          /* Usage message */
     25    int minArgs;                /**< Minimum # args required */
     26    int maxArgs;                /**< Maximum # args required */
     27    const char *usage;          /**< Usage message */
    2828} CmdSpec;
    2929
    3030typedef enum {
    31     CMDSPEC_ARG0,               /* Op is the first argument. */
    32     CMDSPEC_ARG1,               /* Op is the second argument. */
    33     CMDSPEC_ARG2,               /* Op is the third argument. */
    34     CMDSPEC_ARG3,               /* Op is the fourth argument. */
    35     CMDSPEC_ARG4                /* Op is the fifth argument. */
     31    CMDSPEC_ARG0,               /**< Op is the first argument. */
     32    CMDSPEC_ARG1,               /**< Op is the second argument. */
     33    CMDSPEC_ARG2,               /**< Op is the third argument. */
     34    CMDSPEC_ARG3,               /**< Op is the fourth argument. */
     35    CMDSPEC_ARG4                /**< Op is the fifth argument. */
    3636} CmdSpecIndex;
    3737
  • branches/blt4/packages/vizservers/vtkvis/RpContour2D.cpp

    r2120 r2170  
    1111
    1212#include "RpContour2D.h"
     13#include "Trace.h"
    1314
    1415using namespace Rappture::VtkVis;
     
    2728Contour2D::~Contour2D()
    2829{
     30#ifdef WANT_TRACE
     31    if (_dataSet != NULL)
     32        TRACE("Deleting Contour2D for %s", _dataSet->getName().c_str());
     33    else
     34        TRACE("Deleting Contour2D with NULL DataSet");
     35#endif
    2936}
    3037
     
    3845        update();
    3946    }
     47}
     48
     49/**
     50 * \brief Returns the DataSet this Contour2D renders
     51 */
     52DataSet *Contour2D::getDataSet()
     53{
     54    return _dataSet;
    4055}
    4156
     
    5974        _contourActor->GetProperty()->SetLineWidth(_edgeWidth);
    6075        _contourActor->GetProperty()->SetOpacity(_opacity);
     76        _contourActor->GetProperty()->LightingOff();
    6177    }
    6278}
     
    7692    vtkSmartPointer<vtkContourFilter> contourFilter = vtkSmartPointer<vtkContourFilter>::New();
    7793    contourFilter->SetInput(_dataSet->getVtkDataSet());
     94
     95    contourFilter->ComputeNormalsOff();
     96    contourFilter->ComputeGradientsOff();
    7897
    7998    // Speed up multiple contour computation at cost of extra memory use
     
    193212{
    194213    if (_contourMapper != NULL) {
    195         if (planes == NULL)
    196             _contourMapper->RemoveAllClippingPlanes();
    197         else
    198             _contourMapper->SetClippingPlanes(planes);
     214        _contourMapper->SetClippingPlanes(planes);
    199215    }
    200216}
  • branches/blt4/packages/vizservers/vtkvis/RpContour2D.h

    r2120 r2170  
    3030
    3131    void setDataSet(DataSet *dataset);
     32
     33    DataSet *getDataSet();
    3234
    3335    vtkActor *getActor();
  • branches/blt4/packages/vizservers/vtkvis/RpPolyData.cpp

    r2120 r2170  
    3232PolyData::~PolyData()
    3333{
     34#ifdef WANT_TRACE
     35    if (_dataSet != NULL)
     36        TRACE("Deleting PolyData for %s", _dataSet->getName().c_str());
     37    else
     38        TRACE("Deleting PolyData with NULL DataSet");
     39#endif
    3440}
    3541
     
    7985
    8086/**
     87 * \brief Returns the DataSet this PolyData renders
     88 */
     89DataSet *PolyData::getDataSet()
     90{
     91    return _dataSet;
     92}
     93
     94/**
    8195 * \brief Internal method to re-compute contours after a state change
    8296 */
     
    201215{
    202216    if (_pdMapper != NULL) {
    203         if (planes == NULL)
    204             _pdMapper->RemoveAllClippingPlanes();
    205         else
    206             _pdMapper->SetClippingPlanes(planes);
     217        _pdMapper->SetClippingPlanes(planes);
    207218    }
    208219}
  • branches/blt4/packages/vizservers/vtkvis/RpPolyData.h

    r2120 r2170  
    2929
    3030    void setDataSet(DataSet *dataset);
     31
     32    DataSet *getDataSet();
    3133
    3234    vtkActor *getActor();
  • branches/blt4/packages/vizservers/vtkvis/RpPseudoColor.cpp

    r2120 r2170  
    2929PseudoColor::~PseudoColor()
    3030{
     31#ifdef WANT_TRACE
     32    if (_dataSet != NULL)
     33        TRACE("Deleting PseudoColor for %s", _dataSet->getName().c_str());
     34    else
     35        TRACE("Deleting PseudoColor with NULL DataSet");
     36#endif
    3137}
    3238
     
    4046    _dataSet = dataSet;
    4147    update();
     48}
     49
     50/**
     51 * \brief Returns the DataSet this PseudoColor renders
     52 */
     53DataSet *PseudoColor::getDataSet()
     54{
     55    return _dataSet;
    4256}
    4357
     
    8195    _lut->SetRange(dataRange);
    8296
     97    _dsMapper->UseLookupTableScalarRangeOn();
    8398    _dsMapper->SetLookupTable(_lut);
    84     _dsMapper->SetScalarRange(dataRange);
    85     //_dsMapper->GetLookupTable()->SetRange(dataRange);
    8699    //_dsMapper->InterpolateScalarsBeforeMappingOn();
    87100
    88101    initActor();
    89102    _dsActor->SetMapper(_dsMapper);
    90     //_dsActor->GetProperty()->SetRepresentationToWireframe();
    91103}
    92104
     
    149161    }
    150162    if (_dsMapper != NULL) {
     163        _dsMapper->UseLookupTableScalarRangeOn();
    151164        _dsMapper->SetLookupTable(_lut);
    152         if (_dataSet != NULL) {
    153             _dsMapper->SetScalarRange(dataRange);
    154         }
    155165    }
    156166}
     
    230240{
    231241    if (_dsMapper != NULL) {
    232         if (planes == NULL)
    233             _dsMapper->RemoveAllClippingPlanes();
    234         else
    235             _dsMapper->SetClippingPlanes(planes);
     242        _dsMapper->SetClippingPlanes(planes);
    236243    }
    237244}
  • branches/blt4/packages/vizservers/vtkvis/RpPseudoColor.h

    r2120 r2170  
    3131
    3232    void setDataSet(DataSet *dataset);
     33
     34    DataSet *getDataSet();
    3335
    3436    vtkActor *getActor();
  • branches/blt4/packages/vizservers/vtkvis/RpVtkDataSet.cpp

    r2120 r2170  
    6969
    7070/**
     71 * \brief Read dataset using supplied reader
     72 */
     73bool DataSet::setData(vtkDataSet *ds)
     74{
     75    _dataSet = ds;
     76    _dataSet->Update();
     77    _dataSet->GetScalarRange(_dataRange);
     78
     79    TRACE("Scalar Range: %.12e, %.12e", _dataRange[0], _dataRange[1]);
     80    return true;
     81}
     82
     83/**
    7184 * \brief Get the name/id of this dataset
    7285 */
     
    97110 *
    98111 * Note: no interpolation is performed on data
     112 *
     113 * \return the value of the nearest point or 0 if no scalar data available
    99114 */
    100115double DataSet::getDataValue(double x, double y, double z)
     
    102117    if (_dataSet == NULL)
    103118        return 0;
     119    if (_dataSet->GetPointData() == NULL ||
     120        _dataSet->GetPointData()->GetScalars() == NULL) {
     121        return 0.0;
     122    }
    104123    vtkIdType pt = _dataSet->FindPoint(x, y, z);
    105124    return _dataSet->GetPointData()->GetScalars()->GetComponent(pt, 0);
  • branches/blt4/packages/vizservers/vtkvis/RpVtkDataSet.h

    r2120 r2170  
    2929    bool setData(char *data, int nbytes);
    3030
     31    bool setData(vtkDataSet *ds);
     32
     33    bool setData(vtkDataSetReader *reader);
     34
    3135    bool setDataFile(const char *filename);
    3236
     
    4246    DataSet();
    4347
    44     bool setData(vtkDataSetReader *reader);
    45 
    4648    std::string _name;
    4749    vtkSmartPointer<vtkDataSet> _dataSet;
  • branches/blt4/packages/vizservers/vtkvis/RpVtkRenderer.cpp

    r2120 r2170  
    3030
    3131#include "RpVtkRenderer.h"
     32#include "ColorMap.h"
    3233#include "Trace.h"
    3334
     
    3738    _needsRedraw(true),
    3839    _windowWidth(320),
    39     _windowHeight(320)
     40    _windowHeight(320),
     41    _useCumulativeRanges(true)
    4042{
    4143    _bgColor[0] = 0;
    4244    _bgColor[1] = 0;
    4345    _bgColor[2] = 0;
     46    _cumulativeDataRange[0] = 0.0;
     47    _cumulativeDataRange[1] = 1.0;
    4448    // clipping planes to prevent overdrawing axes
    4549    _clippingPlanes = vtkSmartPointer<vtkPlaneCollection>::New();
    4650    // bottom
    47     vtkPlane *plane0 = vtkPlane::New();
     51    vtkSmartPointer<vtkPlane> plane0 = vtkSmartPointer<vtkPlane>::New();
    4852    plane0->SetNormal(0, 1, 0);
    4953    plane0->SetOrigin(0, 0, 0);
    5054    _clippingPlanes->AddItem(plane0);
    5155    // left
    52     vtkPlane *plane1 = vtkPlane::New();
     56    vtkSmartPointer<vtkPlane> plane1 = vtkSmartPointer<vtkPlane>::New();
    5357    plane1->SetNormal(1, 0, 0);
    5458    plane1->SetOrigin(0, 0, 0);
    5559    _clippingPlanes->AddItem(plane1);
    5660   // top
    57     vtkPlane *plane2 = vtkPlane::New();
     61    vtkSmartPointer<vtkPlane> plane2 = vtkSmartPointer<vtkPlane>::New();
    5862    plane2->SetNormal(0, -1, 0);
    5963    plane2->SetOrigin(0, 1, 0);
    6064    _clippingPlanes->AddItem(plane2);
    6165    // right
    62     vtkPlane *plane3 = vtkPlane::New();
     66    vtkSmartPointer<vtkPlane> plane3 = vtkSmartPointer<vtkPlane>::New();
    6367    plane3->SetNormal(-1, 0, 0);
    6468    plane3->SetOrigin(1, 0, 0);
     
    8690    }
    8791    _colorMaps.clear();
    88     for (DataSetHashmap::iterator itr = _dataSets.begin();
    89              itr != _dataSets.end(); ++itr) {
    90         delete itr->second;
    91     }
    92     _dataSets.clear();
    9392    for (PseudoColorHashmap::iterator itr = _pseudoColors.begin();
    9493             itr != _pseudoColors.end(); ++itr) {
     
    106105    }
    107106    _polyDatas.clear();
     107    for (DataSetHashmap::iterator itr = _dataSets.begin();
     108             itr != _dataSets.end(); ++itr) {
     109        delete itr->second;
     110    }
     111    _dataSets.clear();
    108112}
    109113
     
    115119 * be added to the Renderer.
    116120 */
    117 void Renderer::addDataSet(DataSetId id)
     121void Renderer::addDataSet(const DataSetId& id)
    118122{
    119123    if (getDataSet(id) != NULL) {
     
    129133 * The underlying PseudoColor object is deleted, freeing its memory
    130134 */
    131 void Renderer::deletePseudoColor(DataSetId id)
    132 {
    133     PseudoColorHashmap::iterator itr = _pseudoColors.find(id);
     135void Renderer::deletePseudoColor(const DataSetId& id)
     136{
     137    PseudoColorHashmap::iterator itr;
     138
     139    bool doAll = false;
     140
     141    if (id.compare("all") == 0) {
     142        itr = _pseudoColors.begin();
     143        doAll = true;
     144    } else {
     145        itr = _pseudoColors.find(id);
     146    }
    134147    if (itr == _pseudoColors.end()) {
    135148        ERROR("PseudoColor not found: %s", id.c_str());
     
    139152    TRACE("Deleting PseudoColors for %s", id.c_str());
    140153
    141     PseudoColor *ps = itr->second;
    142     if (ps->getActor())
    143         _renderer->RemoveActor(ps->getActor());
    144     delete ps;
    145 
    146     _pseudoColors.erase(itr);
     154    do  {
     155        PseudoColor *ps = itr->second;
     156        if (ps->getActor())
     157            _renderer->RemoveActor(ps->getActor());
     158        delete ps;
     159
     160        _pseudoColors.erase(itr);
     161    } while (doAll && ++itr != _pseudoColors.end());
     162
    147163    _needsRedraw = true;
    148164}
     
    153169 * The underlying Contour2D is deleted, freeing its memory
    154170 */
    155 void Renderer::deleteContour2D(DataSetId id)
    156 {
    157     Contour2DHashmap::iterator itr = _contours.find(id);
     171void Renderer::deleteContour2D(const DataSetId& id)
     172{
     173    Contour2DHashmap::iterator itr;
     174
     175    bool doAll = false;
     176
     177    if (id.compare("all") == 0) {
     178        itr = _contours.begin();
     179        doAll = true;
     180    } else {
     181        itr = _contours.find(id);
     182    }
    158183    if (itr == _contours.end()) {
    159184        ERROR("Contour2D not found: %s", id.c_str());
     
    163188    TRACE("Deleting Contour2Ds for %s", id.c_str());
    164189
    165     Contour2D *contour = itr->second;
    166     if (contour->getActor())
    167         _renderer->RemoveActor(contour->getActor());
    168     delete contour;
    169 
    170     _contours.erase(itr);
     190    do {
     191        Contour2D *contour = itr->second;
     192        if (contour->getActor())
     193            _renderer->RemoveActor(contour->getActor());
     194        delete contour;
     195
     196        _contours.erase(itr);
     197    } while (doAll && ++itr != _contours.end());
     198
    171199    _needsRedraw = true;
    172200}
     
    177205 * The underlying PolyData is deleted, freeing its memory
    178206 */
    179 void Renderer::deletePolyData(DataSetId id)
    180 {
    181     PolyDataHashmap::iterator itr = _polyDatas.find(id);
     207void Renderer::deletePolyData(const DataSetId& id)
     208{
     209    PolyDataHashmap::iterator itr;
     210   
     211    bool doAll = false;
     212
     213    if (id.compare("all") == 0) {
     214        itr = _polyDatas.begin();
     215        doAll = true;
     216    } else {
     217        itr = _polyDatas.find(id);
     218    }
    182219    if (itr == _polyDatas.end()) {
    183220        ERROR("PolyData not found: %s", id.c_str());
     
    187224    TRACE("Deleting PolyDatas for %s", id.c_str());
    188225
    189     PolyData *polyData = itr->second;
    190     if (polyData->getActor())
    191         _renderer->RemoveActor(polyData->getActor());
    192     delete polyData;
    193 
    194     _polyDatas.erase(itr);
     226    do {
     227        PolyData *polyData = itr->second;
     228        if (polyData->getActor())
     229            _renderer->RemoveActor(polyData->getActor());
     230        delete polyData;
     231
     232        _polyDatas.erase(itr);
     233    } while (doAll && ++itr != _polyDatas.end());
     234
    195235    _needsRedraw = true;
    196236}
     
    202242 * objects are deleted, freeing the memory used.
    203243 */
    204 void Renderer::deleteDataSet(DataSetId id)
    205 {
    206     DataSetHashmap::iterator itr = _dataSets.find(id);
     244void Renderer::deleteDataSet(const DataSetId& id)
     245{
     246    DataSetHashmap::iterator itr;
     247
     248    bool doAll = false;
     249
     250    if (id.compare("all") == 0) {
     251        itr = _dataSets.begin();
     252        doAll = true;
     253    } else {
     254        itr = _dataSets.find(id);
     255    }
    207256    if (itr == _dataSets.end()) {
    208257        ERROR("Unknown dataset %s", id.c_str());
    209258        return;
    210     } else {
    211         TRACE("Deleting dataset %s", id.c_str());
    212 
    213         deletePseudoColor(id);
    214         deleteContour2D(id);
    215         deletePolyData(id);
    216        
     259    }
     260
     261    do {
     262        TRACE("Deleting dataset %s", itr->second->getName().c_str());
     263
     264        deletePseudoColor(itr->second->getName());
     265        deleteContour2D(itr->second->getName());
     266        deletePolyData(itr->second->getName());
     267   
    217268        TRACE("After deleting graphics objects");
     269
     270        // Update cumulative data range
     271        collectDataRanges(_cumulativeDataRange);
    218272
    219273        delete itr->second;
    220274        _dataSets.erase(itr);
    221          _needsRedraw = true;
    222     }
     275    } while (doAll && ++itr != _dataSets.end());
     276
     277    _needsRedraw = true;
    223278}
    224279
     
    228283 * \return A pointer to the DataSet, or NULL if not found
    229284 */
    230 DataSet *Renderer::getDataSet(DataSetId id)
     285DataSet *Renderer::getDataSet(const DataSetId& id)
    231286{
    232287    DataSetHashmap::iterator itr = _dataSets.find(id);
     
    241296 * \brief (Re-)load the data for the specified DataSet key from a file
    242297 */
    243 bool Renderer::setDataFile(DataSetId id, const char *filename)
     298bool Renderer::setDataFile(const DataSetId& id, const char *filename)
    244299{
    245300    DataSet *ds = getDataSet(id);
    246301    if (ds) {
    247302        bool ret = ds->setDataFile(filename);
    248         PseudoColor *ps = getPseudoColor(id);
    249         if (ps) {
    250             ps->setDataSet(ds);
    251         }
     303        collectDataRanges(_cumulativeDataRange);
     304        updateRanges(_useCumulativeRanges);
    252305        _needsRedraw = true;
    253306        return ret;
     
    259312 * \brief (Re-)load the data for the specified DataSet key from a memory buffer
    260313 */
    261 bool Renderer::setData(DataSetId id, char *data, int nbytes)
     314bool Renderer::setData(const DataSetId& id, char *data, int nbytes)
    262315{
    263316    DataSet *ds = getDataSet(id);
    264317    if (ds) {
     318        bool ret = ds->setData(data, nbytes);
     319        collectDataRanges(_cumulativeDataRange);
     320        updateRanges(_useCumulativeRanges);
    265321        _needsRedraw = true;
    266         return ds->setData(data, nbytes);
     322        return ret;
    267323    } else
    268324        return false;
     
    521577 * \brief Add a color map for use in the Renderer
    522578 */
    523 void Renderer::addColorMap(ColorMapId id, ColorMap *colorMap)
     579void Renderer::addColorMap(const ColorMapId& id, ColorMap *colorMap)
    524580{
    525581    if (colorMap != NULL) {
     
    538594 * \brief Return the ColorMap associated with the colormap key given
    539595 */
    540 ColorMap *Renderer::getColorMap(ColorMapId id)
     596ColorMap *Renderer::getColorMap(const ColorMapId& id)
    541597{
    542598    ColorMapHashmap::iterator itr = _colorMaps.find(id);
     
    554610 * by any other objects
    555611 */
    556 void Renderer::deleteColorMap(ColorMapId id)
    557 {
    558     ColorMapHashmap::iterator itr = _colorMaps.find(id);
    559     if (itr == _colorMaps.end())
    560         return;
    561 
    562     // TODO: Check if color map is used in PseudoColors?
    563     delete itr->second;
    564     _colorMaps.erase(itr);
     612void Renderer::deleteColorMap(const ColorMapId& id)
     613{
     614    ColorMapHashmap::iterator itr;
     615
     616    bool doAll = false;
     617
     618    if (id.compare("all") == 0) {
     619        itr = _colorMaps.begin();
     620        doAll = true;
     621    } else {
     622        itr = _colorMaps.find(id);
     623    }
     624
     625    if (itr == _colorMaps.end()) {
     626        ERROR("Unknown ColorMap %s", id.c_str());
     627        return;
     628    }
     629
     630    do {
     631        TRACE("Deleting ColorMap %s", itr->second->getName().c_str());
     632
     633        // TODO: Check if color map is used in PseudoColors?
     634        delete itr->second;
     635        _colorMaps.erase(itr);
     636    } while (doAll && ++itr != _colorMaps.end());
    565637}
    566638
     
    568640 * \brief Render a labelled legend image for the given colormap
    569641 *
    570  * \return The image is rendered into the supplied array
    571  */
    572 void Renderer::renderColorMap(ColorMapId id, const char *title,
     642 * \return The image is rendered into the supplied array, false is
     643 * returned if the color map is not found
     644 */
     645bool Renderer::renderColorMap(const ColorMapId& id,
     646                              const DataSetId& dataSetID,
     647                              const char *title,
    573648                              int width, int height,
    574649                              vtkUnsignedCharArray *imgData)
    575650{
     651    ColorMap *colorMap = getColorMap(id);
     652    if (colorMap == NULL)
     653        return false;
     654
    576655    if (_legendRenderWindow == NULL) {
    577656        _legendRenderWindow = vtkSmartPointer<vtkRenderWindow>::New();
     
    593672        _legendRenderer->AddActor(_scalarBarActor);
    594673    }
    595     _scalarBarActor->SetLookupTable(getColorMap(id)->getLookupTable());
     674
     675    vtkSmartPointer<vtkLookupTable> lut = colorMap->getLookupTable();
     676    if (dataSetID.compare("all") == 0) {
     677        lut->SetRange(_cumulativeDataRange);
     678    } else {
     679        DataSet *dataSet = getDataSet(dataSetID);
     680        if (dataSet == NULL) {
     681            lut->SetRange(_cumulativeDataRange);
     682        } else {
     683            double range[2];
     684            dataSet->getDataRange(range);
     685            lut->SetRange(range);
     686        }
     687    }
     688    _scalarBarActor->SetLookupTable(lut);
     689
    596690    // Set viewport-relative width/height/pos
    597691    if (width > height) {
     
    615709
    616710    _legendRenderWindow->GetPixelData(0, 0, width-1, height-1, 1, imgData);
     711    return true;
    617712}
    618713
     
    620715 * \brief Create a new PseudoColor rendering for the specified DataSet
    621716 */
    622 void Renderer::addPseudoColor(DataSetId id)
    623 {
    624     DataSet *ds = getDataSet(id);
    625     if (ds == NULL)
    626         return;
    627 
    628     if (getPseudoColor(id)) {
    629         WARN("Replacing existing pseudocolor %s", id.c_str());
    630         deletePseudoColor(id);
    631     }
    632     PseudoColor *pc = new PseudoColor();
    633     _pseudoColors[id] = pc;
    634 
    635     pc->setDataSet(ds);
    636 
    637     _renderer->AddActor(pc->getActor());
     717void Renderer::addPseudoColor(const DataSetId& id)
     718{
     719    DataSetHashmap::iterator itr;
     720
     721    bool doAll = false;
     722
     723    if (id.compare("all") == 0) {
     724        itr = _dataSets.begin();
     725    } else {
     726        itr = _dataSets.find(id);
     727    }
     728    if (itr == _dataSets.end()) {
     729        ERROR("Unknown dataset %s", id.c_str());
     730        return;
     731    }
     732
     733    do {
     734        DataSet *ds = itr->second;
     735        const DataSetId& dsID = ds->getName();
     736
     737        if (getPseudoColor(dsID)) {
     738            WARN("Replacing existing pseudocolor %s", dsID.c_str());
     739            deletePseudoColor(dsID);
     740        }
     741        PseudoColor *pc = new PseudoColor();
     742        _pseudoColors[dsID] = pc;
     743
     744        pc->setDataSet(ds);
     745
     746        _renderer->AddActor(pc->getActor());
     747    } while (doAll && ++itr != _dataSets.end());
    638748
    639749    initCamera();
     
    644754 * \brief Get the PseudoColor associated with the specified DataSet
    645755 */
    646 PseudoColor *Renderer::getPseudoColor(DataSetId id)
     756PseudoColor *Renderer::getPseudoColor(const DataSetId& id)
    647757{
    648758    PseudoColorHashmap::iterator itr = _pseudoColors.find(id);
     
    658768 * \brief Associate an existing named color map with a DataSet
    659769 */
    660 void Renderer::setPseudoColorColorMap(DataSetId id, ColorMapId colorMapId)
    661 {
    662     PseudoColor *pc = getPseudoColor(id);
    663     if (pc) {
    664         ColorMap *cmap = getColorMap(colorMapId);
    665         if (cmap) {
    666             TRACE("Set color map: %s for dataset %s", colorMapId.c_str(),
    667                   id.c_str());
    668             pc->setLookupTable(cmap->getLookupTable());
    669              _needsRedraw = true;
    670         } else {
    671             ERROR("Unknown colormap: %s", colorMapId.c_str());
    672         }
    673     } else {
    674         ERROR("No pseudocolor for dataset %s", id.c_str());
    675     }
     770void Renderer::setPseudoColorColorMap(const DataSetId& id, const ColorMapId& colorMapId)
     771{
     772    PseudoColorHashmap::iterator itr;
     773
     774    bool doAll = false;
     775
     776    if (id.compare("all") == 0) {
     777        itr = _pseudoColors.begin();
     778        doAll = true;
     779    } else {
     780        itr = _pseudoColors.find(id);
     781    }
     782
     783    if (itr == _pseudoColors.end()) {
     784        ERROR("PseudoColor not found: %s", id.c_str());
     785        return;
     786    }
     787
     788    ColorMap *cmap = getColorMap(colorMapId);
     789    if (cmap == NULL) {
     790        ERROR("Unknown colormap: %s", colorMapId.c_str());
     791        return;
     792    }
     793
     794    do {
     795        TRACE("Set color map: %s for dataset %s", colorMapId.c_str(),
     796              itr->second->getDataSet()->getName().c_str());
     797
     798        // Make a copy of the generic colormap lookup table, so
     799        // data range can be set in the copy table to match the
     800        // dataset being plotted
     801        vtkSmartPointer<vtkLookupTable> lut = vtkSmartPointer<vtkLookupTable>::New();
     802        lut->DeepCopy(cmap->getLookupTable());
     803
     804        itr->second->setLookupTable(lut);
     805    } while (doAll && ++itr != _pseudoColors.end());
     806
     807    _needsRedraw = true;
    676808}
    677809
     
    681813 * \return The associated lookup table or NULL if not found
    682814 */
    683 vtkLookupTable *Renderer::getPseudoColorColorMap(DataSetId id)
     815vtkLookupTable *Renderer::getPseudoColorColorMap(const DataSetId& id)
    684816{
    685817    PseudoColor *pc = getPseudoColor(id);
     
    691823
    692824/**
     825 * \brief Set opacity of the PseudoColor for the given DataSet
     826 */
     827void Renderer::setPseudoColorOpacity(const DataSetId& id, double opacity)
     828{
     829    PseudoColorHashmap::iterator itr;
     830
     831    bool doAll = false;
     832
     833    if (id.compare("all") == 0) {
     834        itr = _pseudoColors.begin();
     835        doAll = true;
     836    } else {
     837        itr = _pseudoColors.find(id);
     838    }
     839
     840    if (itr == _pseudoColors.end()) {
     841        ERROR("PseudoColor not found: %s", id.c_str());
     842        return;
     843    }
     844
     845    do {
     846        itr->second->setOpacity(opacity);
     847    } while (doAll && ++itr != _pseudoColors.end());
     848
     849    _needsRedraw = true;
     850}
     851
     852/**
    693853 * \brief Turn on/off rendering of the PseudoColor mapper for the given DataSet
    694854 */
    695 void Renderer::setPseudoColorVisibility(DataSetId id, bool state)
    696 {
    697     PseudoColor *pc = getPseudoColor(id);
    698     if (pc) {
    699         pc->setVisibility(state);
    700         _needsRedraw = true;
    701     }
     855void Renderer::setPseudoColorVisibility(const DataSetId& id, bool state)
     856{
     857    PseudoColorHashmap::iterator itr;
     858
     859    bool doAll = false;
     860
     861    if (id.compare("all") == 0) {
     862        itr = _pseudoColors.begin();
     863        doAll = true;
     864    } else {
     865        itr = _pseudoColors.find(id);
     866    }
     867
     868    if (itr == _pseudoColors.end()) {
     869        ERROR("PseudoColor not found: %s", id.c_str());
     870        return;
     871    }
     872
     873    do {
     874        itr->second->setVisibility(state);
     875    } while (doAll && ++itr != _pseudoColors.end());
     876
     877    _needsRedraw = true;
    702878}
    703879
     
    705881 * \brief Set the visibility of polygon edges for the specified DataSet
    706882 */
    707 void Renderer::setPseudoColorEdgeVisibility(DataSetId id, bool state)
    708 {
    709     PseudoColor *pc = getPseudoColor(id);
    710     if (pc) {
    711         pc->setEdgeVisibility(state);
    712         _needsRedraw = true;
    713     }
     883void Renderer::setPseudoColorEdgeVisibility(const DataSetId& id, bool state)
     884{
     885    PseudoColorHashmap::iterator itr;
     886
     887    bool doAll = false;
     888
     889    if (id.compare("all") == 0) {
     890        itr = _pseudoColors.begin();
     891        doAll = true;
     892    } else {
     893        itr = _pseudoColors.find(id);
     894    }
     895
     896    if (itr == _pseudoColors.end()) {
     897        ERROR("PseudoColor not found: %s", id.c_str());
     898        return;
     899    }
     900
     901    do {
     902        itr->second->setEdgeVisibility(state);
     903    } while (doAll && ++itr != _pseudoColors.end());
     904
     905    _needsRedraw = true;
    714906}
    715907
     
    717909 * \brief Set the RGB polygon edge color for the specified DataSet
    718910 */
    719 void Renderer::setPseudoColorEdgeColor(DataSetId id, float color[3])
    720 {
    721     PseudoColor *pc = getPseudoColor(id);
    722     if (pc) {
    723         pc->setEdgeColor(color);
    724         _needsRedraw = true;
    725     }
     911void Renderer::setPseudoColorEdgeColor(const DataSetId& id, float color[3])
     912{
     913    PseudoColorHashmap::iterator itr;
     914
     915    bool doAll = false;
     916
     917    if (id.compare("all") == 0) {
     918        itr = _pseudoColors.begin();
     919        doAll = true;
     920    } else {
     921        itr = _pseudoColors.find(id);
     922    }
     923
     924    if (itr == _pseudoColors.end()) {
     925        ERROR("PseudoColor not found: %s", id.c_str());
     926        return;
     927    }
     928
     929    do {
     930        itr->second->setEdgeColor(color);
     931    } while (doAll && ++itr != _pseudoColors.end());
     932
     933    _needsRedraw = true;
    726934}
    727935
     
    732940 * this function may not have an effect.
    733941 */
    734 void Renderer::setPseudoColorEdgeWidth(DataSetId id, float edgeWidth)
    735 {
    736     PseudoColor *pc = getPseudoColor(id);
    737     if (pc) {
    738         pc->setEdgeWidth(edgeWidth);
    739         _needsRedraw = true;
    740     }
     942void Renderer::setPseudoColorEdgeWidth(const DataSetId& id, float edgeWidth)
     943{
     944    PseudoColorHashmap::iterator itr;
     945
     946    bool doAll = false;
     947
     948    if (id.compare("all") == 0) {
     949        itr = _pseudoColors.begin();
     950        doAll = true;
     951    } else {
     952        itr = _pseudoColors.find(id);
     953    }
     954
     955    if (itr == _pseudoColors.end()) {
     956        ERROR("PseudoColor not found: %s", id.c_str());
     957        return;
     958    }
     959
     960    do {
     961        itr->second->setEdgeWidth(edgeWidth);
     962    } while (doAll && ++itr != _pseudoColors.end());
     963
     964    _needsRedraw = true;
    741965}
    742966
     
    744968 * \brief Turn mesh lighting on/off for the specified DataSet
    745969 */
    746 void Renderer::setPseudoColorLighting(DataSetId id, bool state)
    747 {
    748     PseudoColor *pc = getPseudoColor(id);
    749     if (pc) {
    750         pc->setLighting(state);
    751         _needsRedraw = true;
    752     }
     970void Renderer::setPseudoColorLighting(const DataSetId& id, bool state)
     971{
     972    PseudoColorHashmap::iterator itr;
     973
     974    bool doAll = false;
     975
     976    if (id.compare("all") == 0) {
     977        itr = _pseudoColors.begin();
     978        doAll = true;
     979    } else {
     980        itr = _pseudoColors.find(id);
     981    }
     982
     983    if (itr == _pseudoColors.end()) {
     984        ERROR("PseudoColor not found: %s", id.c_str());
     985        return;
     986    }
     987
     988    do {
     989        itr->second->setLighting(state);
     990    } while (doAll && ++itr != _pseudoColors.end());
     991
     992    _needsRedraw = true;
    753993}
    754994
     
    756996 * \brief Create a new Contour2D and associate it with the named DataSet
    757997 */
    758 void Renderer::addContour2D(DataSetId id)
    759 {
    760     DataSet *ds = getDataSet(id);
    761     if (ds == NULL)
    762         return;
    763 
    764     if (getContour2D(id)) {
    765         WARN("Replacing existing contour2d %s", id.c_str());
    766         deleteContour2D(id);
    767     }
    768 
    769     Contour2D *contour = new Contour2D();
    770     _contours[id] = contour;
    771 
    772     contour->setDataSet(ds);
    773 
    774     _renderer->AddActor(contour->getActor());
     998void Renderer::addContour2D(const DataSetId& id)
     999{
     1000    DataSetHashmap::iterator itr;
     1001
     1002    bool doAll = false;
     1003
     1004    if (id.compare("all") == 0) {
     1005        itr = _dataSets.begin();
     1006    } else {
     1007        itr = _dataSets.find(id);
     1008    }
     1009    if (itr == _dataSets.end()) {
     1010        ERROR("Unknown dataset %s", id.c_str());
     1011        return;
     1012    }
     1013
     1014    do {
     1015        DataSet *ds = itr->second;
     1016        const DataSetId& dsID = ds->getName();
     1017
     1018        if (getContour2D(dsID)) {
     1019            WARN("Replacing existing contour2d %s", dsID.c_str());
     1020            deleteContour2D(dsID);
     1021        }
     1022
     1023        Contour2D *contour = new Contour2D();
     1024        _contours[dsID] = contour;
     1025
     1026        contour->setDataSet(ds);
     1027
     1028        _renderer->AddActor(contour->getActor());
     1029    } while (doAll && ++itr != _dataSets.end());
    7751030
    7761031    initCamera();
     
    7811036 * \brief Get the Contour2D associated with a named DataSet
    7821037 */
    783 Contour2D *Renderer::getContour2D(DataSetId id)
     1038Contour2D *Renderer::getContour2D(const DataSetId& id)
    7841039{
    7851040    Contour2DHashmap::iterator itr = _contours.find(id);
     
    7951050 * \brief Set the number of equally spaced contour isolines for the given DataSet
    7961051 */
    797 void Renderer::setContours(DataSetId id, int numContours)
    798 {
    799     Contour2D *contour = getContour2D(id);
    800     if (contour) {
    801         contour->setContours(numContours);
    802         _needsRedraw = true;
    803     }
     1052void Renderer::setContours(const DataSetId& id, int numContours)
     1053{
     1054    Contour2DHashmap::iterator itr;
     1055
     1056    bool doAll = false;
     1057
     1058    if (id.compare("all") == 0) {
     1059        itr = _contours.begin();
     1060        doAll = true;
     1061    } else {
     1062        itr = _contours.find(id);
     1063    }
     1064    if (itr == _contours.end()) {
     1065        ERROR("Contour2D not found: %s", id.c_str());
     1066        return;
     1067    }
     1068
     1069    do {
     1070        itr->second->setContours(numContours);
     1071    } while (doAll && ++itr != _contours.end());
     1072
     1073    _needsRedraw = true;
    8041074}
    8051075
     
    8071077 * \brief Set a list of isovalues for the given DataSet
    8081078 */
    809 void Renderer::setContourList(DataSetId id, const std::vector<double>& contours)
    810 {
    811     Contour2D *contour = getContour2D(id);
    812     if (contour) {
    813         contour->setContourList(contours);
    814         _needsRedraw = true;
    815     }
     1079void Renderer::setContourList(const DataSetId& id, const std::vector<double>& contours)
     1080{
     1081    Contour2DHashmap::iterator itr;
     1082
     1083    bool doAll = false;
     1084
     1085    if (id.compare("all") == 0) {
     1086        itr = _contours.begin();
     1087        doAll = true;
     1088    } else {
     1089        itr = _contours.find(id);
     1090    }
     1091    if (itr == _contours.end()) {
     1092        ERROR("Contour2D not found: %s", id.c_str());
     1093        return;
     1094    }
     1095
     1096    do {
     1097        itr->second->setContourList(contours);
     1098    } while (doAll && ++itr != _contours.end());
     1099
     1100     _needsRedraw = true;
     1101}
     1102
     1103/**
     1104 * \brief Set opacity of contour lines for the given DataSet
     1105 */
     1106void Renderer::setContourOpacity(const DataSetId& id, double opacity)
     1107{
     1108    Contour2DHashmap::iterator itr;
     1109
     1110    bool doAll = false;
     1111
     1112    if (id.compare("all") == 0) {
     1113        itr = _contours.begin();
     1114        doAll = true;
     1115    } else {
     1116        itr = _contours.find(id);
     1117    }
     1118    if (itr == _contours.end()) {
     1119        ERROR("Contour2D not found: %s", id.c_str());
     1120        return;
     1121    }
     1122
     1123    do {
     1124        itr->second->setOpacity(opacity);
     1125    } while (doAll && ++itr != _contours.end());
     1126
     1127    _needsRedraw = true;
    8161128}
    8171129
     
    8191131 * \brief Turn on/off rendering contour lines for the given DataSet
    8201132 */
    821 void Renderer::setContourVisibility(DataSetId id, bool state)
    822 {
    823     Contour2D *contour = getContour2D(id);
    824     if (contour) {
    825         contour->setVisibility(state);
    826         _needsRedraw = true;
    827     }
     1133void Renderer::setContourVisibility(const DataSetId& id, bool state)
     1134{
     1135    Contour2DHashmap::iterator itr;
     1136
     1137    bool doAll = false;
     1138
     1139    if (id.compare("all") == 0) {
     1140        itr = _contours.begin();
     1141        doAll = true;
     1142    } else {
     1143        itr = _contours.find(id);
     1144    }
     1145    if (itr == _contours.end()) {
     1146        ERROR("Contour2D not found: %s", id.c_str());
     1147        return;
     1148    }
     1149
     1150    do {
     1151        itr->second->setVisibility(state);
     1152    } while (doAll && ++itr != _contours.end());
     1153
     1154    _needsRedraw = true;
    8281155}
    8291156
     
    8311158 * \brief Set the RGB isoline color for the specified DataSet
    8321159 */
    833 void Renderer::setContourEdgeColor(DataSetId id, float color[3])
    834 {
    835     Contour2D *contour = getContour2D(id);
    836     if (contour) {
    837         contour->setEdgeColor(color);
    838         _needsRedraw = true;
    839     }
     1160void Renderer::setContourEdgeColor(const DataSetId& id, float color[3])
     1161{
     1162    Contour2DHashmap::iterator itr;
     1163
     1164    bool doAll = false;
     1165
     1166    if (id.compare("all") == 0) {
     1167        itr = _contours.begin();
     1168        doAll = true;
     1169    } else {
     1170        itr = _contours.find(id);
     1171    }
     1172    if (itr == _contours.end()) {
     1173        ERROR("Contour2D not found: %s", id.c_str());
     1174        return;
     1175    }
     1176
     1177    do {
     1178        itr->second->setEdgeColor(color);
     1179    } while (doAll && ++itr != _contours.end());
     1180
     1181    _needsRedraw = true;
    8401182}
    8411183
     
    8461188 * this function may not have an effect.
    8471189 */
    848 void Renderer::setContourEdgeWidth(DataSetId id, float edgeWidth)
    849 {
    850     Contour2D *contour = getContour2D(id);
    851     if (contour) {
    852         contour->setEdgeWidth(edgeWidth);
    853         _needsRedraw = true;
    854     }
     1190void Renderer::setContourEdgeWidth(const DataSetId& id, float edgeWidth)
     1191{
     1192    Contour2DHashmap::iterator itr;
     1193
     1194    bool doAll = false;
     1195
     1196    if (id.compare("all") == 0) {
     1197        itr = _contours.begin();
     1198        doAll = true;
     1199    } else {
     1200        itr = _contours.find(id);
     1201    }
     1202    if (itr == _contours.end()) {
     1203        ERROR("Contour2D not found: %s", id.c_str());
     1204        return;
     1205    }
     1206
     1207    do {
     1208        itr->second->setEdgeWidth(edgeWidth);
     1209    } while (doAll && ++itr != _contours.end());
     1210
     1211    _needsRedraw = true;
    8551212}
    8561213
     
    8581215 * \brief Turn contour lighting on/off for the specified DataSet
    8591216 */
    860 void Renderer::setContourLighting(DataSetId id, bool state)
    861 {
    862     Contour2D *contour = getContour2D(id);
    863     if (contour) {
    864         contour->setLighting(state);
    865         _needsRedraw = true;
    866     }
     1217void Renderer::setContourLighting(const DataSetId& id, bool state)
     1218{
     1219    Contour2DHashmap::iterator itr;
     1220
     1221    bool doAll = false;
     1222
     1223    if (id.compare("all") == 0) {
     1224        itr = _contours.begin();
     1225        doAll = true;
     1226    } else {
     1227        itr = _contours.find(id);
     1228    }
     1229    if (itr == _contours.end()) {
     1230        ERROR("Contour2D not found: %s", id.c_str());
     1231        return;
     1232    }
     1233
     1234    do {
     1235        itr->second->setLighting(state);
     1236    } while (doAll && ++itr != _contours.end());
     1237    _needsRedraw = true;
    8671238}
    8681239
     
    8701241 * \brief Create a new PolyData and associate it with the named DataSet
    8711242 */
    872 void Renderer::addPolyData(DataSetId id)
    873 {
    874     DataSet *ds = getDataSet(id);
    875     if (ds == NULL)
    876         return;
    877 
    878     if (getPolyData(id)) {
    879         WARN("Replacing existing polydata %s", id.c_str());
    880         deletePolyData(id);
    881     }
    882 
    883     PolyData *polyData = new PolyData();
    884     _polyDatas[id] = polyData;
    885 
    886     polyData->setDataSet(ds);
    887 
    888     _renderer->AddActor(polyData->getActor());
     1243void Renderer::addPolyData(const DataSetId& id)
     1244{
     1245    DataSetHashmap::iterator itr;
     1246
     1247    bool doAll = false;
     1248
     1249    if (id.compare("all") == 0) {
     1250        itr = _dataSets.begin();
     1251    } else {
     1252        itr = _dataSets.find(id);
     1253    }
     1254    if (itr == _dataSets.end()) {
     1255        ERROR("Unknown dataset %s", id.c_str());
     1256        return;
     1257    }
     1258
     1259    do {
     1260        DataSet *ds = itr->second;
     1261        const DataSetId& dsID = ds->getName();
     1262
     1263        if (getPolyData(dsID)) {
     1264            WARN("Replacing existing polydata %s", dsID.c_str());
     1265            deletePolyData(dsID);
     1266        }
     1267
     1268        PolyData *polyData = new PolyData();
     1269        _polyDatas[dsID] = polyData;
     1270
     1271        polyData->setDataSet(ds);
     1272
     1273        _renderer->AddActor(polyData->getActor());
     1274    } while (doAll && ++itr != _dataSets.end());
    8891275
    8901276    if (_cameraMode == IMAGE)
     
    8971283 * \brief Get the PolyData associated with a named DataSet
    8981284 */
    899 PolyData *Renderer::getPolyData(DataSetId id)
     1285PolyData *Renderer::getPolyData(const DataSetId& id)
    9001286{
    9011287    PolyDataHashmap::iterator itr = _polyDatas.find(id);
     
    9091295
    9101296/**
     1297 * \brief Set opacity of the PolyData for the given DataSet
     1298 */
     1299void Renderer::setPolyDataOpacity(const DataSetId& id, double opacity)
     1300{
     1301    PolyDataHashmap::iterator itr;
     1302   
     1303    bool doAll = false;
     1304
     1305    if (id.compare("all") == 0) {
     1306        itr = _polyDatas.begin();
     1307        doAll = true;
     1308    } else {
     1309        itr = _polyDatas.find(id);
     1310    }
     1311    if (itr == _polyDatas.end()) {
     1312        ERROR("PolyData not found: %s", id.c_str());
     1313        return;
     1314    }
     1315
     1316    do {
     1317        itr->second->setOpacity(opacity);
     1318    } while (doAll && ++itr != _polyDatas.end());
     1319
     1320    _needsRedraw = true;
     1321}
     1322
     1323/**
    9111324 * \brief Turn on/off rendering of the PolyData mapper for the given DataSet
    9121325 */
    913 void Renderer::setPolyDataVisibility(DataSetId id, bool state)
    914 {
    915     PolyData *polyData = getPolyData(id);
    916     if (polyData) {
    917         polyData->setVisibility(state);
    918         _needsRedraw = true;
    919     }
     1326void Renderer::setPolyDataVisibility(const DataSetId& id, bool state)
     1327{
     1328    PolyDataHashmap::iterator itr;
     1329   
     1330    bool doAll = false;
     1331
     1332    if (id.compare("all") == 0) {
     1333        itr = _polyDatas.begin();
     1334        doAll = true;
     1335    } else {
     1336        itr = _polyDatas.find(id);
     1337    }
     1338    if (itr == _polyDatas.end()) {
     1339        ERROR("PolyData not found: %s", id.c_str());
     1340        return;
     1341    }
     1342
     1343    do {
     1344        itr->second->setVisibility(state);
     1345    } while (doAll && ++itr != _polyDatas.end());
     1346
     1347    _needsRedraw = true;
    9201348}
    9211349
     
    9231351 * \brief Set the RGB polygon face color for the specified DataSet
    9241352 */
    925 void Renderer::setPolyDataColor(DataSetId id, float color[3])
    926 {
    927     PolyData *polyData = getPolyData(id);
    928     if (polyData) {
    929         polyData->setColor(color);
    930         _needsRedraw = true;
    931     }
     1353void Renderer::setPolyDataColor(const DataSetId& id, float color[3])
     1354{
     1355    PolyDataHashmap::iterator itr;
     1356   
     1357    bool doAll = false;
     1358
     1359    if (id.compare("all") == 0) {
     1360        itr = _polyDatas.begin();
     1361        doAll = true;
     1362    } else {
     1363        itr = _polyDatas.find(id);
     1364    }
     1365    if (itr == _polyDatas.end()) {
     1366        ERROR("PolyData not found: %s", id.c_str());
     1367        return;
     1368    }
     1369
     1370    do {
     1371        itr->second->setColor(color);
     1372    } while (doAll && ++itr != _polyDatas.end());
     1373    _needsRedraw = true;
    9321374}
    9331375
     
    9351377 * \brief Set the visibility of polygon edges for the specified DataSet
    9361378 */
    937 void Renderer::setPolyDataEdgeVisibility(DataSetId id, bool state)
    938 {
    939     PolyData *polyData = getPolyData(id);
    940     if (polyData) {
    941         polyData->setEdgeVisibility(state);
    942         _needsRedraw = true;
    943     }
     1379void Renderer::setPolyDataEdgeVisibility(const DataSetId& id, bool state)
     1380{
     1381    PolyDataHashmap::iterator itr;
     1382   
     1383    bool doAll = false;
     1384
     1385    if (id.compare("all") == 0) {
     1386        itr = _polyDatas.begin();
     1387        doAll = true;
     1388    } else {
     1389        itr = _polyDatas.find(id);
     1390    }
     1391    if (itr == _polyDatas.end()) {
     1392        ERROR("PolyData not found: %s", id.c_str());
     1393        return;
     1394    }
     1395
     1396    do {
     1397        itr->second->setEdgeVisibility(state);
     1398    } while (doAll && ++itr != _polyDatas.end());
     1399
     1400    _needsRedraw = true;
    9441401}
    9451402
     
    9471404 * \brief Set the RGB polygon edge color for the specified DataSet
    9481405 */
    949 void Renderer::setPolyDataEdgeColor(DataSetId id, float color[3])
    950 {
    951     PolyData *polyData = getPolyData(id);
    952     if (polyData) {
    953         polyData->setEdgeColor(color);
    954         _needsRedraw = true;
    955     }
     1406void Renderer::setPolyDataEdgeColor(const DataSetId& id, float color[3])
     1407{
     1408    PolyDataHashmap::iterator itr;
     1409   
     1410    bool doAll = false;
     1411
     1412    if (id.compare("all") == 0) {
     1413        itr = _polyDatas.begin();
     1414        doAll = true;
     1415    } else {
     1416        itr = _polyDatas.find(id);
     1417    }
     1418    if (itr == _polyDatas.end()) {
     1419        ERROR("PolyData not found: %s", id.c_str());
     1420        return;
     1421    }
     1422
     1423    do {
     1424        itr->second->setEdgeColor(color);
     1425    } while (doAll && ++itr != _polyDatas.end());
     1426
     1427    _needsRedraw = true;
    9561428}
    9571429
     
    9621434 * this function may not have an effect.
    9631435 */
    964 void Renderer::setPolyDataEdgeWidth(DataSetId id, float edgeWidth)
    965 {
    966     PolyData *polyData = getPolyData(id);
    967     if (polyData) {
    968         polyData->setEdgeWidth(edgeWidth);
    969         _needsRedraw = true;
    970     }
     1436void Renderer::setPolyDataEdgeWidth(const DataSetId& id, float edgeWidth)
     1437{
     1438    PolyDataHashmap::iterator itr;
     1439   
     1440    bool doAll = false;
     1441
     1442    if (id.compare("all") == 0) {
     1443        itr = _polyDatas.begin();
     1444        doAll = true;
     1445    } else {
     1446        itr = _polyDatas.find(id);
     1447    }
     1448    if (itr == _polyDatas.end()) {
     1449        ERROR("PolyData not found: %s", id.c_str());
     1450        return;
     1451    }
     1452
     1453    do {
     1454        itr->second->setEdgeWidth(edgeWidth);
     1455    } while (doAll && ++itr != _polyDatas.end());
     1456
     1457    _needsRedraw = true;
    9711458}
    9721459
     
    9741461 * \brief Set wireframe rendering for the specified DataSet
    9751462 */
    976 void Renderer::setPolyDataWireframe(DataSetId id, bool state)
    977 {
    978     PolyData *polyData = getPolyData(id);
    979     if (polyData) {
    980         polyData->setWireframe(state);
    981         _needsRedraw = true;
    982     }
     1463void Renderer::setPolyDataWireframe(const DataSetId& id, bool state)
     1464{
     1465    PolyDataHashmap::iterator itr;
     1466   
     1467    bool doAll = false;
     1468
     1469    if (id.compare("all") == 0) {
     1470        itr = _polyDatas.begin();
     1471        doAll = true;
     1472    } else {
     1473        itr = _polyDatas.find(id);
     1474    }
     1475    if (itr == _polyDatas.end()) {
     1476        ERROR("PolyData not found: %s", id.c_str());
     1477        return;
     1478    }
     1479
     1480    do {
     1481        itr->second->setWireframe(state);
     1482    } while (doAll && ++itr != _polyDatas.end());
     1483
     1484    _needsRedraw = true;
    9831485}
    9841486
     
    9861488 * \brief Turn mesh lighting on/off for the specified DataSet
    9871489 */
    988 void Renderer::setPolyDataLighting(DataSetId id, bool state)
    989 {
    990     PolyData *polyData = getPolyData(id);
    991     if (polyData) {
    992         polyData->setLighting(state);
    993         _needsRedraw = true;
    994     }
     1490void Renderer::setPolyDataLighting(const DataSetId& id, bool state)
     1491{
     1492    PolyDataHashmap::iterator itr;
     1493   
     1494    bool doAll = false;
     1495
     1496    if (id.compare("all") == 0) {
     1497        itr = _polyDatas.begin();
     1498        doAll = true;
     1499    } else {
     1500        itr = _polyDatas.find(id);
     1501    }
     1502    if (itr == _polyDatas.end()) {
     1503        ERROR("PolyData not found: %s", id.c_str());
     1504        return;
     1505    }
     1506
     1507    do {
     1508        itr->second->setLighting(state);
     1509    } while (doAll && ++itr != _polyDatas.end());
     1510
     1511    _needsRedraw = true;
    9951512}
    9961513
     
    12891806        }
    12901807    }
     1808}
     1809
     1810/**
     1811 * \brief Update data ranges for color-mapping
     1812 *
     1813 * \param[in] useCumulative Use cumulative range of all DataSets
     1814 */
     1815void Renderer::updateRanges(bool useCumulative)
     1816{
     1817    for (PseudoColorHashmap::iterator itr = _pseudoColors.begin();
     1818         itr != _pseudoColors.end(); ++itr) {
     1819        vtkLookupTable *lut = itr->second->getLookupTable();
     1820        if (lut) {
     1821            if (useCumulative) {
     1822                lut->SetRange(_cumulativeDataRange);
     1823            } else {
     1824                double range[2];
     1825                if (itr->second->getDataSet()) {
     1826                    itr->second->getDataSet()->getDataRange(range);
     1827                    lut->SetRange(range);
     1828                }
     1829            }
     1830        }
     1831    }
     1832}
     1833
     1834/**
     1835 * \brief Collect cumulative data range of all DataSets
     1836 *
     1837 * \param[inout] range Data range of all DataSets
     1838 */
     1839void Renderer::collectDataRanges(double *range)
     1840{
     1841    range[0] = DBL_MAX;
     1842    range[1] = -DBL_MAX;
     1843
     1844    for (DataSetHashmap::iterator itr = _dataSets.begin();
     1845         itr != _dataSets.end(); ++itr) {
     1846        double r[2];
     1847        itr->second->getDataRange(r);
     1848        range[0] = min2(range[0], r[0]);
     1849        range[1] = max2(range[1], r[1]);
     1850    }
     1851    if (range[0] == DBL_MAX)
     1852        range[0] = 0;
     1853    if (range[1] == -DBL_MAX)
     1854        range[1] = 1;
    12911855}
    12921856
     
    13571921 * \brief Set the opacity of the specified DataSet's associated graphics objects
    13581922 */
    1359 void Renderer::setOpacity(DataSetId id, double opacity)
    1360 {
    1361     PseudoColor *pc = getPseudoColor(id);
    1362     if (pc) {
    1363         pc->setOpacity(opacity);
    1364         _needsRedraw = true;
    1365     }
    1366     Contour2D *contour = getContour2D(id);
    1367     if (contour) {
    1368         contour->setOpacity(opacity);
    1369         _needsRedraw = true;
    1370     }
    1371     PolyData *polyData = getPolyData(id);
    1372     if (polyData) {
    1373         polyData->setOpacity(opacity);
    1374         _needsRedraw = true;
    1375     }
     1923void Renderer::setOpacity(const DataSetId& id, double opacity)
     1924{
     1925    setPseudoColorOpacity(id, opacity);
     1926    setContourOpacity(id, opacity);
     1927    setPolyDataOpacity(id, opacity);
    13761928}
    13771929
     
    13791931 * \brief Turn on/off rendering of the specified DataSet's associated graphics objects
    13801932 */
    1381 void Renderer::setVisibility(DataSetId id, bool state)
     1933void Renderer::setVisibility(const DataSetId& id, bool state)
    13821934{
    13831935    setPseudoColorVisibility(id, state);
     
    14021954            for (Contour2DHashmap::iterator itr = _contours.begin();
    14031955                 itr != _contours.end(); ++itr) {
     1956                itr->second->setClippingPlanes(_clippingPlanes);
     1957            }
     1958            for (PolyDataHashmap::iterator itr = _polyDatas.begin();
     1959                 itr != _polyDatas.end(); ++itr) {
    14041960                itr->second->setClippingPlanes(_clippingPlanes);
    14051961            }
     
    14131969                itr->second->setClippingPlanes(NULL);
    14141970            }
     1971            for (PolyDataHashmap::iterator itr = _polyDatas.begin();
     1972                 itr != _polyDatas.end(); ++itr) {
     1973                itr->second->setClippingPlanes(NULL);
     1974            }
    14151975        }
    14161976        _renderWindow->Render();
     
    14472007 * Note: no interpolation is performed on data
    14482008 */
    1449 double Renderer::getDataValueAtPixel(DataSetId id, int x, int y)
     2009double Renderer::getDataValueAtPixel(const DataSetId& id, int x, int y)
    14502010{
    14512011    vtkSmartPointer<vtkCoordinate> coord = vtkSmartPointer<vtkCoordinate>::New();
     
    14692029 * Note: no interpolation is performed on data
    14702030 */
    1471 double Renderer::getDataValue(DataSetId id, double x, double y, double z)
     2031double Renderer::getDataValue(const DataSetId& id, double x, double y, double z)
    14722032{
    14732033    DataSet *ds = getDataSet(id);
  • branches/blt4/packages/vizservers/vtkvis/RpVtkRenderer.h

    r2120 r2170  
    6666    // Data sets
    6767
    68     void addDataSet(DataSetId id);
    69 
    70     void deleteDataSet(DataSetId id);
    71 
    72     DataSet *getDataSet(DataSetId id);
    73 
    74     bool setData(DataSetId id, char *data, int nbytes);
    75 
    76     bool setDataFile(DataSetId id, const char *filename);
    77 
    78     double getDataValueAtPixel(DataSetId id, int x, int y);
    79 
    80     double getDataValue(DataSetId id, double x, double y, double z);
    81 
    82     void setOpacity(DataSetId id, double opacity);
    83 
    84     void setVisibility(DataSetId id, bool state);
     68    void addDataSet(const DataSetId& id);
     69
     70    void deleteDataSet(const DataSetId& id);
     71
     72    DataSet *getDataSet(const DataSetId& id);
     73
     74    bool setData(const DataSetId& id, char *data, int nbytes);
     75
     76    bool setDataFile(const DataSetId& id, const char *filename);
     77
     78    double getDataValueAtPixel(const DataSetId& id, int x, int y);
     79
     80    double getDataValue(const DataSetId& id, double x, double y, double z);
     81
     82    void setOpacity(const DataSetId& id, double opacity);
     83
     84    void setVisibility(const DataSetId& id, bool state);
    8585
    8686    // Render window
     
    132132    // Colormaps
    133133
    134     void addColorMap(ColorMapId id, ColorMap *colorMap);
    135 
    136     void deleteColorMap(ColorMapId id);
    137 
    138     ColorMap *getColorMap(ColorMapId id);
    139 
    140     void renderColorMap(ColorMapId id, const char *title,
     134    void addColorMap(const ColorMapId& id, ColorMap *colorMap);
     135
     136    void deleteColorMap(const ColorMapId& id);
     137
     138    ColorMap *getColorMap(const ColorMapId& id);
     139
     140    bool renderColorMap(const ColorMapId& id,
     141                        const DataSetId& dataSetID,
     142                        const char *title,
    141143                        int width, int height,
    142144                        vtkUnsignedCharArray *imgData);
     
    144146    // Color-mapped surfaces
    145147
    146     void addPseudoColor(DataSetId id);
    147 
    148     void deletePseudoColor(DataSetId id);
    149 
    150     PseudoColor *getPseudoColor(DataSetId id);
    151 
    152     void setPseudoColorColorMap(DataSetId id, ColorMapId colorMapId);
    153 
    154     vtkLookupTable *getPseudoColorColorMap(DataSetId id);
    155 
    156     void setPseudoColorVisibility(DataSetId id, bool state);
    157 
    158     void setPseudoColorEdgeVisibility(DataSetId id, bool state);
    159 
    160     void setPseudoColorEdgeColor(DataSetId id, float color[3]);
    161 
    162     void setPseudoColorEdgeWidth(DataSetId id, float edgeWidth);
    163 
    164     void setPseudoColorLighting(DataSetId id, bool state);
     148    void addPseudoColor(const DataSetId& id);
     149
     150    void deletePseudoColor(const DataSetId& id);
     151
     152    PseudoColor *getPseudoColor(const DataSetId& id);
     153
     154    void setPseudoColorColorMap(const DataSetId& id, const ColorMapId& colorMapId);
     155
     156    vtkLookupTable *getPseudoColorColorMap(const DataSetId& id);
     157
     158    void setPseudoColorOpacity(const DataSetId& id, double opacity);
     159
     160    void setPseudoColorVisibility(const DataSetId& id, bool state);
     161
     162    void setPseudoColorEdgeVisibility(const DataSetId& id, bool state);
     163
     164    void setPseudoColorEdgeColor(const DataSetId& id, float color[3]);
     165
     166    void setPseudoColorEdgeWidth(const DataSetId& id, float edgeWidth);
     167
     168    void setPseudoColorLighting(const DataSetId& id, bool state);
    165169
    166170    // Contour plots
    167171
    168     void addContour2D(DataSetId id);
    169 
    170     void deleteContour2D(DataSetId id);
    171 
    172     Contour2D *getContour2D(DataSetId id);
    173 
    174     void setContours(DataSetId id, int numContours);
    175 
    176     void setContourList(DataSetId id, const std::vector<double>& contours);
    177 
    178     void setContourVisibility(DataSetId id, bool state);
    179 
    180     void setContourEdgeColor(DataSetId id, float color[3]);
    181 
    182     void setContourEdgeWidth(DataSetId id, float edgeWidth);
    183 
    184     void setContourLighting(DataSetId id, bool state);
     172    void addContour2D(const DataSetId& id);
     173
     174    void deleteContour2D(const DataSetId& id);
     175
     176    Contour2D *getContour2D(const DataSetId& id);
     177
     178    void setContours(const DataSetId& id, int numContours);
     179
     180    void setContourList(const DataSetId& id, const std::vector<double>& contours);
     181
     182    void setContourOpacity(const DataSetId& id, double opacity);
     183
     184    void setContourVisibility(const DataSetId& id, bool state);
     185
     186    void setContourEdgeColor(const DataSetId& id, float color[3]);
     187
     188    void setContourEdgeWidth(const DataSetId& id, float edgeWidth);
     189
     190    void setContourLighting(const DataSetId& id, bool state);
    185191
    186192    // Meshes
    187193
    188     void addPolyData(DataSetId id);
     194    void addPolyData(const DataSetId& id);
    189195   
    190     void deletePolyData(DataSetId id);
    191 
    192     PolyData *getPolyData(DataSetId id);
    193 
    194     void setPolyDataVisibility(DataSetId id, bool state);
    195 
    196     void setPolyDataColor(DataSetId id, float color[3]);
    197 
    198     void setPolyDataEdgeVisibility(DataSetId id, bool state);
    199 
    200     void setPolyDataEdgeColor(DataSetId id, float color[3]);
    201 
    202     void setPolyDataEdgeWidth(DataSetId id, float edgeWidth);
    203 
    204     void setPolyDataWireframe(DataSetId id, bool state);
    205 
    206     void setPolyDataLighting(DataSetId id, bool state);
     196    void deletePolyData(const DataSetId& id);
     197
     198    PolyData *getPolyData(const DataSetId& id);
     199
     200    void setPolyDataOpacity(const DataSetId& id, double opacity);
     201
     202    void setPolyDataVisibility(const DataSetId& id, bool state);
     203
     204    void setPolyDataColor(const DataSetId& id, float color[3]);
     205
     206    void setPolyDataEdgeVisibility(const DataSetId& id, bool state);
     207
     208    void setPolyDataEdgeColor(const DataSetId& id, float color[3]);
     209
     210    void setPolyDataEdgeWidth(const DataSetId& id, float edgeWidth);
     211
     212    void setPolyDataWireframe(const DataSetId& id, bool state);
     213
     214    void setPolyDataLighting(const DataSetId& id, bool state);
    207215
    208216private:
     
    220228    void collectBounds(double *bounds, bool onlyVisible);
    221229
     230    void collectDataRanges(double *range);
     231
     232    void updateRanges(bool useCumulative);
     233
    222234    void storeCameraOrientation();
    223235    void restoreCameraOrientation();
     
    234246    double _cameraUp[3];
    235247    float _bgColor[3];
     248    bool _useCumulativeRanges;
     249    double _cumulativeDataRange[2];
    236250
    237251    ColorMapHashmap _colorMaps;
  • branches/blt4/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp

    r2120 r2170  
    172172    {"name", 1, AxisNameOp, 4, 4, "axis title"},
    173173    {"units", 1, AxisUnitsOp, 4, 4, "axis units"},
    174     {"visible", 1, AxisVisibleOp, 4, 4, "axis bool"},
     174    {"visible", 1, AxisVisibleOp, 4, 4, "axis bool"}
    175175};
    176176static int nAxisOps = NumCmdSpecs(axisOps);
     
    298298    {"reset", 2, CameraResetOp, 2, 3, "?all?"},
    299299    {"rotate", 2, CameraRotateOp, 5, 5, "angle angle angle"},
    300     {"zoom", 1, CameraZoomOp, 3, 3, "zoomAmount"},
     300    {"zoom", 1, CameraZoomOp, 3, 3, "zoomAmount"}
    301301};
    302302static int nCameraOps = NumCmdSpecs(cameraOps);
     
    400400                 Tcl_Obj *const *objv)
    401401{
    402     const char *name = Tcl_GetString(objv[2]);
    403     g_renderer->deleteColorMap(name);
     402    if (objc == 3) {
     403        const char *name = Tcl_GetString(objv[2]);
     404        g_renderer->deleteColorMap(name);
     405    } else {
     406        g_renderer->deleteColorMap("all");
     407    }
    404408    return TCL_OK;
    405409}
     
    407411static Rappture::CmdSpec colorMapOps[] = {
    408412    {"add", 1, ColorMapAddOp, 5, 5, "colorMapName colormap alphamap"},
    409     {"delete", 1, ColorMapDeleteOp, 3, 3, "colorMapName"}
     413    {"delete", 1, ColorMapDeleteOp, 2, 3, "?colorMapName?"}
    410414};
    411415static int nColorMapOps = NumCmdSpecs(colorMapOps);
     
    429433                          Tcl_Obj *const *objv)
    430434{
    431     const char *name = Tcl_GetString(objv[4]);
    432     g_renderer->addContour2D(name);
    433435    std::vector<double> contourList;
    434436
     
    448450    }
    449451
    450     g_renderer->setContourList(name, contourList);
     452    if (objc == 5) {
     453        const char *name = Tcl_GetString(objv[4]);
     454        g_renderer->addContour2D(name);
     455        g_renderer->setContourList(name, contourList);
     456    } else {
     457        g_renderer->addContour2D("all");
     458        g_renderer->setContourList("all", contourList);
     459    }
    451460    return TCL_OK;
    452461}
     
    456465                          Tcl_Obj *const *objv)
    457466{
    458     const char *name = Tcl_GetString(objv[4]);
    459     g_renderer->addContour2D(name);
    460467    int numContours;
    461468    if (Tcl_GetIntFromObj(interp, objv[3], &numContours) != TCL_OK) {
    462469        return TCL_ERROR;
    463470    }
    464     g_renderer->setContours(name, numContours);
     471    if (objc == 5) {
     472        const char *name = Tcl_GetString(objv[4]);
     473        g_renderer->addContour2D(name);
     474        g_renderer->setContours(name, numContours);
     475    } else {
     476        g_renderer->addContour2D("all");
     477        g_renderer->setContours("all", numContours);
     478    }
    465479    return TCL_OK;
    466480}
    467481
    468482static Rappture::CmdSpec contour2dAddOps[] = {
    469     {"contourlist", 1, Contour2DAddContourListOp, 5, 5, "contourList dataSetName"},
    470     {"numcontours", 1, Contour2DAddNumContoursOp, 5, 5, "numContours dataSetName"}
     483    {"contourlist", 1, Contour2DAddContourListOp, 4, 5, "contourList ?dataSetName?"},
     484    {"numcontours", 1, Contour2DAddNumContoursOp, 4, 5, "numContours ?dataSetName?"}
    471485};
    472486static int nContour2dAddOps = NumCmdSpecs(contour2dAddOps);
     
    490504                  Tcl_Obj *const *objv)
    491505{
    492     const char *name = Tcl_GetString(objv[2]);
    493     g_renderer->deleteContour2D(name);
     506    if (objc == 3) {
     507        const char *name = Tcl_GetString(objv[2]);
     508        g_renderer->deleteContour2D(name);
     509    } else {
     510        g_renderer->deleteContour2D("all");
     511    }
    494512    return TCL_OK;
    495513}
     
    499517                    Tcl_Obj *const *objv)
    500518{
    501     const char *name = Tcl_GetString(objv[3]);
    502519    bool state;
    503520    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    504521        return TCL_ERROR;
    505522    }
    506     g_renderer->setContourLighting(name, state);
     523    if (objc == 4) {
     524        const char *name = Tcl_GetString(objv[3]);
     525        g_renderer->setContourLighting(name, state);
     526    } else {
     527        g_renderer->setContourLighting("all", state);
     528    }
    507529    return TCL_OK;
    508530}
     
    512534                     Tcl_Obj *const *objv)
    513535{
    514     const char *name = Tcl_GetString(objv[5]);
    515536    float color[3];
    516537    if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||
     
    519540        return TCL_ERROR;
    520541    }
    521     g_renderer->setContourEdgeColor(name, color);
     542    if (objc == 6) {
     543        const char *name = Tcl_GetString(objv[5]);
     544        g_renderer->setContourEdgeColor(name, color);
     545    } else {
     546        g_renderer->setContourEdgeColor("all", color);
     547    }
    522548    return TCL_OK;
    523549}
     
    527553                     Tcl_Obj *const *objv)
    528554{
    529     const char *name = Tcl_GetString(objv[3]);
    530555    float width;
    531556    if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) {
    532557        return TCL_ERROR;
    533558    }
    534     g_renderer->setContourEdgeWidth(name, width);
     559    if (objc == 4) {
     560        const char *name = Tcl_GetString(objv[3]);
     561        g_renderer->setContourEdgeWidth(name, width);
     562    } else {
     563        g_renderer->setContourEdgeWidth("all", width);
     564    }
     565    return TCL_OK;
     566}
     567
     568static int
     569Contour2DOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc,
     570                   Tcl_Obj *const *objv)
     571{
     572    double opacity;
     573    if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) {
     574        return TCL_ERROR;
     575    }
     576    if (objc == 4) {
     577        const char *name = Tcl_GetString(objv[3]);
     578        g_renderer->setContourOpacity(name, opacity);
     579    } else {
     580        g_renderer->setContourOpacity("all", opacity);
     581    }
    535582    return TCL_OK;
    536583}
     
    540587                   Tcl_Obj *const *objv)
    541588{
    542     const char *name = Tcl_GetString(objv[3]);
    543589    bool state;
    544590    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    545591        return TCL_ERROR;
    546592    }
    547     g_renderer->setContourVisibility(name, state);
     593    if (objc == 4) {
     594        const char *name = Tcl_GetString(objv[3]);
     595        g_renderer->setContourVisibility(name, state);
     596    } else {
     597        g_renderer->setContourVisibility("all", state);
     598    }
    548599    return TCL_OK;
    549600}
    550601
    551602static Rappture::CmdSpec contour2dOps[] = {
    552     {"add", 1, Contour2DAddOp, 5, 5, "oper value dataSetName"},
    553     {"delete", 1, Contour2DDeleteOp, 3, 3, "dataSetName"},
    554     {"lighting", 3, Contour2DLightingOp, 4, 4, "bool dataSetName"},
    555     {"linecolor", 5, Contour2DLineColorOp, 6, 6, "r g b dataSetName"},
    556     {"linewidth", 5, Contour2DLineWidthOp, 4, 4, "width dataSetName"},
    557     {"visible", 1, Contour2DVisibleOp, 4, 4, "bool dataSetName"},
     603    {"add", 1, Contour2DAddOp, 4, 5, "oper value ?dataSetName?"},
     604    {"delete", 1, Contour2DDeleteOp, 2, 3, "?dataSetName?"},
     605    {"lighting", 3, Contour2DLightingOp, 3, 4, "bool ?dataSetName?"},
     606    {"linecolor", 5, Contour2DLineColorOp, 5, 6, "r g b ?dataSetName?"},
     607    {"linewidth", 5, Contour2DLineWidthOp, 3, 4, "width ?dataSetName?"},
     608    {"opacity", 1, Contour2DOpacityOp, 3, 4, "value ?dataSetName?"},
     609    {"visible", 1, Contour2DVisibleOp, 3, 4, "bool ?dataSetName?"}
    558610};
    559611static int nContour2dOps = NumCmdSpecs(contour2dOps);
     
    627679                Tcl_Obj *const *objv)
    628680{
    629     const char *name = Tcl_GetString(objv[2]);
    630     TRACE("Deleting dataset %s", name);
    631     g_renderer->deleteDataSet(name);
     681    if (objc == 3) {
     682        const char *name = Tcl_GetString(objv[2]);
     683        TRACE("Deleting dataset %s", name);
     684        g_renderer->deleteDataSet(name);
     685    } else {
     686        g_renderer->deleteDataSet("all");
     687    }
    632688    return TCL_OK;
    633689}
     
    712768                 Tcl_Obj *const *objv)
    713769{
    714     const char *name = Tcl_GetString(objv[3]);
    715770    double opacity;
    716771    if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) {
    717772        return TCL_ERROR;
    718773    }
    719     g_renderer->setOpacity(name, opacity);
     774    if (objc == 4) {
     775        const char *name = Tcl_GetString(objv[3]);
     776        g_renderer->setOpacity(name, opacity);
     777    } else {
     778        g_renderer->setOpacity("all", opacity);
     779    }
    720780    return TCL_OK;
    721781}
     
    725785                 Tcl_Obj *const *objv)
    726786{
    727     const char *name = Tcl_GetString(objv[3]);
    728787    bool state;
    729788    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    730789        return TCL_ERROR;
    731790    }
    732     g_renderer->setVisibility(name, state);
     791    if (objc == 4) {
     792        const char *name = Tcl_GetString(objv[3]);
     793        g_renderer->setVisibility(name, state);
     794    } else {
     795        g_renderer->setVisibility("all", state);
     796    }
    733797    return TCL_OK;
    734798}
     
    736800static Rappture::CmdSpec dataSetOps[] = {
    737801    {"add", 1, DataSetAddOp, 6, 6, "name data follows nBytes"},
    738     {"delete", 1, DataSetDeleteOp, 3, 3, "name"},
     802    {"delete", 1, DataSetDeleteOp, 2, 3, "?name?"},
    739803    {"getvalue", 1, DataSetGetValueOp, 6, 7, "oper x y ?z? name"},
    740     {"opacity", 1, DataSetOpacityOp, 4, 4, "value name"},
    741     {"visible", 1, DataSetVisibleOp, 4, 4, "bool name"}
     804    {"opacity", 1, DataSetOpacityOp, 3, 4, "value ?name?"},
     805    {"visible", 1, DataSetVisibleOp, 3, 4, "bool ?name?"}
    742806};
    743807static int nDataSetOps = NumCmdSpecs(dataSetOps);
     
    763827    if (objc < 4) {
    764828        Tcl_AppendResult(interp, "wrong # args: should be \"",
    765                 Tcl_GetString(objv[0]), " colormapName title width height\"", (char*)NULL);
     829                Tcl_GetString(objv[0]), " colormapName title width height ?dataSetName?\"", (char*)NULL);
    766830        return TCL_ERROR;
    767831    }
     
    778842        vtkSmartPointer<vtkUnsignedCharArray>::New();
    779843
    780     g_renderer->renderColorMap(name, title, width, height, imgData);
     844    if (objc == 6) {
     845        const char *dataSetName = Tcl_GetString(objv[5]);
     846        if (!g_renderer->renderColorMap(name, dataSetName, title, width, height, imgData)) {
     847            Tcl_AppendResult(interp, "Color map \"",
     848                             name, "\" was not found", (char*)NULL);
     849            return TCL_ERROR;
     850        }
     851    } else {
     852        if (!g_renderer->renderColorMap(name, "all", title, width, height, imgData)) {
     853            Tcl_AppendResult(interp, "Color map \"",
     854                             name, "\" was not found", (char*)NULL);
     855            return TCL_ERROR;
     856        }
     857    }
    781858
    782859#ifdef DEBUG
     
    795872               Tcl_Obj *const *objv)
    796873{
    797     const char *name = Tcl_GetString(objv[2]);
    798     g_renderer->addPseudoColor(name);
     874    if (objc == 3) {
     875        const char *name = Tcl_GetString(objv[2]);
     876        g_renderer->addPseudoColor(name);
     877    } else {
     878        g_renderer->addPseudoColor("all");
     879    }
    799880    return TCL_OK;
    800881}
     
    805886{
    806887    const char *colorMapName = Tcl_GetString(objv[2]);
    807     const char *dataSetName = Tcl_GetString(objv[3]);
    808     g_renderer->setPseudoColorColorMap(dataSetName, colorMapName);
     888    if (objc == 4) {
     889        const char *dataSetName = Tcl_GetString(objv[3]);
     890        g_renderer->setPseudoColorColorMap(dataSetName, colorMapName);
     891    } else {
     892        g_renderer->setPseudoColorColorMap("all", colorMapName);
     893    }
    809894    return TCL_OK;
    810895}
     
    814899                  Tcl_Obj *const *objv)
    815900{
    816     const char *name = Tcl_GetString(objv[2]);
    817     g_renderer->deletePseudoColor(name);
    818     return TCL_OK;
    819 }
    820 
    821 static int
    822 PseudoColorVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc,
    823                      Tcl_Obj *const *objv)
    824 {
    825     const char *name = Tcl_GetString(objv[3]);
     901    if (objc == 3) {
     902        const char *name = Tcl_GetString(objv[2]);
     903        g_renderer->deletePseudoColor(name);
     904    } else {
     905        g_renderer->deletePseudoColor("all");
     906    }
     907    return TCL_OK;
     908}
     909
     910static int
     911PseudoColorEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc,
     912                            Tcl_Obj *const *objv)
     913{
    826914    bool state;
    827915    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    828916        return TCL_ERROR;
    829917    }
    830     g_renderer->setPseudoColorVisibility(name, state);
    831     return TCL_OK;
    832 }
    833 
    834 static int
    835 PseudoColorEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc,
    836                             Tcl_Obj *const *objv)
    837 {
    838     const char *name = Tcl_GetString(objv[3]);
     918    if (objc == 4) {
     919        const char *name = Tcl_GetString(objv[3]);
     920        g_renderer->setPseudoColorEdgeVisibility(name, state);
     921    } else {
     922        g_renderer->setPseudoColorEdgeVisibility("all", state);
     923    }
     924    return TCL_OK;
     925}
     926
     927static int
     928PseudoColorLightingOp(ClientData clientData, Tcl_Interp *interp, int objc,
     929                      Tcl_Obj *const *objv)
     930{
    839931    bool state;
    840932    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    841933        return TCL_ERROR;
    842934    }
    843     g_renderer->setPseudoColorEdgeVisibility(name, state);
    844     return TCL_OK;
    845 }
    846 
    847 static int
    848 PseudoColorLightingOp(ClientData clientData, Tcl_Interp *interp, int objc,
    849                       Tcl_Obj *const *objv)
    850 {
    851     const char *name = Tcl_GetString(objv[3]);
    852     bool state;
    853     if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    854         return TCL_ERROR;
    855     }
    856     g_renderer->setPseudoColorLighting(name, state);
     935    if (objc == 4) {
     936        const char *name = Tcl_GetString(objv[3]);
     937        g_renderer->setPseudoColorLighting(name, state);
     938    } else {
     939        g_renderer->setPseudoColorLighting("all", state);
     940    }
    857941    return TCL_OK;
    858942}
     
    862946                       Tcl_Obj *const *objv)
    863947{
    864     const char *name = Tcl_GetString(objv[5]);
    865948    float color[3];
    866949    if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||
     
    869952        return TCL_ERROR;
    870953    }
    871     g_renderer->setPseudoColorEdgeColor(name, color);
     954    if (objc == 6) {
     955        const char *name = Tcl_GetString(objv[5]);
     956        g_renderer->setPseudoColorEdgeColor(name, color);
     957    } else {
     958        g_renderer->setPseudoColorEdgeColor("all", color);
     959    }
    872960    return TCL_OK;
    873961}
     
    877965                       Tcl_Obj *const *objv)
    878966{
    879     const char *name = Tcl_GetString(objv[3]);
    880967    float width;
    881968    if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) {
    882969        return TCL_ERROR;
    883970    }
    884     g_renderer->setPseudoColorEdgeWidth(name, width);
     971    if (objc == 4) {
     972        const char *name = Tcl_GetString(objv[3]);
     973        g_renderer->setPseudoColorEdgeWidth(name, width);
     974    } else {
     975        g_renderer->setPseudoColorEdgeWidth("all", width);
     976    }
     977    return TCL_OK;
     978}
     979
     980static int
     981PseudoColorOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc,
     982                     Tcl_Obj *const *objv)
     983{
     984    double opacity;
     985    if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) {
     986        return TCL_ERROR;
     987    }
     988    if (objc == 4) {
     989        const char *name = Tcl_GetString(objv[3]);
     990        g_renderer->setPseudoColorOpacity(name, opacity);
     991    } else {
     992        g_renderer->setPseudoColorOpacity("all", opacity);
     993    }
     994    return TCL_OK;
     995}
     996
     997static int
     998PseudoColorVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc,
     999                     Tcl_Obj *const *objv)
     1000{
     1001    bool state;
     1002    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     1003        return TCL_ERROR;
     1004    }
     1005    if (objc == 4) {
     1006        const char *name = Tcl_GetString(objv[3]);
     1007        g_renderer->setPseudoColorVisibility(name, state);
     1008    } else {
     1009        g_renderer->setPseudoColorVisibility("all", state);
     1010    }
    8851011    return TCL_OK;
    8861012}
    8871013
    8881014static Rappture::CmdSpec pseudoColorOps[] = {
    889     {"add", 1, PseudoColorAddOp, 3, 3, "dataSetName"},
    890     {"colormap", 1, PseudoColorColorMapOp, 4, 4, "colorMapName dataSetName"},
    891     {"delete", 1, PseudoColorDeleteOp, 3, 3, "dataSetName"},
    892     {"edges", 1, PseudoColorEdgeVisibilityOp, 4, 4, "bool dataSetName"},
    893     {"lighting", 3, PseudoColorLightingOp, 4, 4, "bool dataSetName"},
    894     {"linecolor", 5, PseudoColorLineColorOp, 6, 6, "r g b dataSetName"},
    895     {"linewidth", 5, PseudoColorLineWidthOp, 4, 4, "width dataSetName"},
    896     {"visible", 1, PseudoColorVisibleOp, 4, 4, "bool dataSetName"}
     1015    {"add", 1, PseudoColorAddOp, 2, 3, "?dataSetName?"},
     1016    {"colormap", 1, PseudoColorColorMapOp, 3, 4, "colorMapName ?dataSetName?"},
     1017    {"delete", 1, PseudoColorDeleteOp, 2, 3, "?dataSetName?"},
     1018    {"edges", 1, PseudoColorEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"},
     1019    {"lighting", 3, PseudoColorLightingOp, 3, 4, "bool ?dataSetName?"},
     1020    {"linecolor", 5, PseudoColorLineColorOp, 5, 6, "r g b ?dataSetName?"},
     1021    {"linewidth", 5, PseudoColorLineWidthOp, 3, 4, "width ?dataSetName?"},
     1022    {"opacity", 1, PseudoColorOpacityOp, 3, 4, "value ?dataSetName?"},
     1023    {"visible", 1, PseudoColorVisibleOp, 3, 4, "bool ?dataSetName?"}
    8971024};
    8981025static int nPseudoColorOps = NumCmdSpecs(pseudoColorOps);
     
    9161043              Tcl_Obj *const *objv)
    9171044{
    918     const char *name = Tcl_GetString(objv[2]);
    919     g_renderer->addPolyData(name);
     1045    if (objc == 3) {
     1046        const char *name = Tcl_GetString(objv[2]);
     1047        g_renderer->addPolyData(name);
     1048    } else {
     1049        g_renderer->addPolyData("all");
     1050    }
    9201051    return TCL_OK;
    9211052}
     
    9251056                 Tcl_Obj *const *objv)
    9261057{
    927     const char *name = Tcl_GetString(objv[2]);
    928     g_renderer->deletePolyData(name);
     1058    if (objc == 3) {
     1059        const char *name = Tcl_GetString(objv[2]);
     1060        g_renderer->deletePolyData(name);
     1061    } else {
     1062        g_renderer->deletePolyData("all");
     1063    }
    9291064    return TCL_OK;
    9301065}
     
    9341069                Tcl_Obj *const *objv)
    9351070{
    936     const char *name = Tcl_GetString(objv[5]);
    9371071    float color[3];
    9381072    if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||
     
    9411075        return TCL_ERROR;
    9421076    }
    943     g_renderer->setPolyDataColor(name, color);
     1077    if (objc == 6) {
     1078        const char *name = Tcl_GetString(objv[5]);
     1079        g_renderer->setPolyDataColor(name, color);
     1080    } else {
     1081        g_renderer->setPolyDataColor("all", color);
     1082    }
    9441083    return TCL_OK;
    9451084}
     
    9491088                         Tcl_Obj *const *objv)
    9501089{
    951     const char *name = Tcl_GetString(objv[3]);
    9521090    bool state;
    9531091    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    9541092        return TCL_ERROR;
    9551093    }
    956     g_renderer->setPolyDataEdgeVisibility(name, state);
     1094    if (objc == 4) {
     1095        const char *name = Tcl_GetString(objv[3]);
     1096        g_renderer->setPolyDataEdgeVisibility(name, state);
     1097    } else {
     1098        g_renderer->setPolyDataEdgeVisibility("all", state);
     1099    }
    9571100    return TCL_OK;
    9581101}
     
    9621105                   Tcl_Obj *const *objv)
    9631106{
    964     const char *name = Tcl_GetString(objv[3]);
    9651107    bool state;
    9661108    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    9671109        return TCL_ERROR;
    9681110    }
    969     g_renderer->setPolyDataLighting(name, state);
     1111    if (objc == 4) {
     1112        const char *name = Tcl_GetString(objv[3]);
     1113        g_renderer->setPolyDataLighting(name, state);
     1114    } else {
     1115        g_renderer->setPolyDataLighting("all", state);
     1116    }
    9701117    return TCL_OK;
    9711118}
     
    9751122                    Tcl_Obj *const *objv)
    9761123{
    977     const char *name = Tcl_GetString(objv[5]);
    9781124    float color[3];
    9791125    if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||
     
    9821128        return TCL_ERROR;
    9831129    }
    984     g_renderer->setPolyDataEdgeColor(name, color);
     1130    if (objc == 6) {
     1131        const char *name = Tcl_GetString(objv[5]);
     1132        g_renderer->setPolyDataEdgeColor(name, color);
     1133    } else {
     1134        g_renderer->setPolyDataEdgeColor("all", color);
     1135    }
    9851136    return TCL_OK;
    9861137}
     
    9901141                    Tcl_Obj *const *objv)
    9911142{
    992     const char *name = Tcl_GetString(objv[3]);
    9931143    float width;
    9941144    if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) {
    9951145        return TCL_ERROR;
    9961146    }
    997     g_renderer->setPolyDataEdgeWidth(name, width);
     1147    if (objc == 4) {
     1148        const char *name = Tcl_GetString(objv[3]);
     1149        g_renderer->setPolyDataEdgeWidth(name, width);
     1150    } else {
     1151        g_renderer->setPolyDataEdgeWidth("all", width);
     1152    }
     1153    return TCL_OK;
     1154}
     1155
     1156static int
     1157PolyDataOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1158                  Tcl_Obj *const *objv)
     1159{
     1160    double opacity;
     1161    if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) {
     1162        return TCL_ERROR;
     1163    }
     1164    if (objc == 4) {
     1165        const char *name = Tcl_GetString(objv[3]);
     1166        g_renderer->setPolyDataOpacity(name, opacity);
     1167    } else {
     1168        g_renderer->setPolyDataOpacity("all", opacity);
     1169    }
    9981170    return TCL_OK;
    9991171}
     
    10031175                  Tcl_Obj *const *objv)
    10041176{
    1005     const char *name = Tcl_GetString(objv[3]);
    10061177    bool state;
    10071178    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    10081179        return TCL_ERROR;
    10091180    }
    1010     g_renderer->setPolyDataVisibility(name, state);
     1181    if (objc == 4) {
     1182        const char *name = Tcl_GetString(objv[3]);
     1183        g_renderer->setPolyDataVisibility(name, state);
     1184    } else {
     1185        g_renderer->setPolyDataVisibility("all", state);
     1186    }
    10111187    return TCL_OK;
    10121188}
     
    10161192                    Tcl_Obj *const *objv)
    10171193{
    1018     const char *name = Tcl_GetString(objv[3]);
    10191194    bool state;
    10201195    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    10211196        return TCL_ERROR;
    10221197    }
    1023     g_renderer->setPolyDataWireframe(name, state);
     1198    if (objc == 4) {
     1199        const char *name = Tcl_GetString(objv[3]);
     1200        g_renderer->setPolyDataWireframe(name, state);
     1201    } else {
     1202        g_renderer->setPolyDataWireframe("all", state);
     1203    }
    10241204    return TCL_OK;
    10251205}
    10261206
    10271207static Rappture::CmdSpec polyDataOps[] = {
    1028     {"add", 1, PolyDataAddOp, 3, 3, "dataSetName"},
    1029     {"color", 1, PolyDataColorOp, 6, 6, "r g b dataSetName"},
    1030     {"delete", 1, PolyDataDeleteOp, 3, 3, "dataSetName"},
    1031     {"edges", 1, PolyDataEdgeVisibilityOp, 4, 4, "bool dataSetName"},
    1032     {"lighting", 3, PolyDataLightingOp, 4, 4, "bool dataSetName"},
    1033     {"linecolor", 5, PolyDataLineColorOp, 6, 6, "r g b dataSetName"},
    1034     {"linewidth", 5, PolyDataLineWidthOp, 4, 4, "width dataSetName"},
    1035     {"visible", 1, PolyDataVisibleOp, 4, 4, "bool dataSetName"},
    1036     {"wireframe", 1, PolyDataWireframeOp, 4, 4, "bool dataSetName"}
     1208    {"add", 1, PolyDataAddOp, 2, 3, "?dataSetName?"},
     1209    {"color", 1, PolyDataColorOp, 5, 6, "r g b ?dataSetName?"},
     1210    {"delete", 1, PolyDataDeleteOp, 2, 3, "?dataSetName?"},
     1211    {"edges", 1, PolyDataEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"},
     1212    {"lighting", 3, PolyDataLightingOp, 3, 4, "bool ?dataSetName?"},
     1213    {"linecolor", 5, PolyDataLineColorOp, 5, 6, "r g b ?dataSetName?"},
     1214    {"linewidth", 5, PolyDataLineWidthOp, 3, 4, "width ?dataSetName?"},
     1215    {"opacity", 1, PolyDataOpacityOp, 3, 4, "value ?dataSetName?"},
     1216    {"visible", 1, PolyDataVisibleOp, 3, 4, "bool ?dataSetName?"},
     1217    {"wireframe", 1, PolyDataWireframeOp, 3, 4, "bool ?dataSetName?"}
    10371218};
    10381219static int nPolyDataOps = NumCmdSpecs(polyDataOps);
  • branches/blt4/packages/vizservers/vtkvis/protocol.txt

    r2120 r2170  
    3131       Specify zoom ratio
    3232
     33colormap add <colorMapName> <colorMap> <opacityMap>
     34         colorMap = Tcl list of {value r g b} control points
     35         opacityMap = Tcl list of {value alpha} control points
     36colormap delete <?colorMapName?>
     37
     38legend <colormapName> <legendTitle> <width> <height> <?datasetName?>
     39       Causes legend to be rendered and written back with labels and title
     40
    3341dataset add <datasetName> data follows <nbytes>
    34 dataset delete <datasetName>
     42dataset delete <?datasetName?>
    3543dataset getvalue world <x> <y> <z> <datasetName>
    3644dataset getvalue pixel <x> <y> <datasetName>
    3745        Use pixel for image camera mode
    38 dataset opacity <val> <datasetName>
    39 dataset visible <bool> <datasetName>
     46dataset opacity <val> <?datasetName?>
     47dataset visible <bool> <?datasetName?>
    4048
    41 colormap add <colorMapName> <colorMap> <opacityMap>
    42          colorMap = Tcl list of {value r g b} control points
    43          opacityMap = Tcl list of {value alpha} control points
    44 colormap delete <colorMapName>
     49pseudocolor add <?datasetName?>
     50pseudocolor colormap <colormapName> <?datasetName?>
     51pseudocolor delete <?datasetName?>
     52pseudocolor edges <bool> <?datasetName?>
     53pseudocolor lighting <bool> <?datasetName?>
     54pseudocolor linecolor <r> <g> <b> <?datasetName?>
     55pseudocolor linewidth <val> <?datasetName?>
     56pseudocolor opacity <val> <?datasetName?>
     57pseudocolor visible <bool> <?datasetName?>
    4558
    46 legend <colormapName> <legendTitle> <width> <height>
    47        Causes legend to be rendered and written back with labels and title
     59contour2d add numcontours <n> <?datasetName?>
     60contour2d add contourlist <list> <?datasetName?>
     61          list = {isoval1 isoval2 isoval3...}
     62contour2d delete <?datasetName?>
     63contour2d lighting <bool> <?datasetName?>
     64contour2d linecolor <r> <g> <b> <?datasetName?>
     65contour2d linewidth <val> <?datasetName?>
     66contour2d opacity <val> <?datasetName?>
     67contour2d visible <bool> <?datasetName?>
    4868
    49 pseudocolor add <datasetName>
    50 pseudocolor colormap <colormapName> <datasetName>
    51 pseudocolor delete <datasetName>
    52 pseudocolor edges <bool> <datasetName>
    53 pseudocolor linecolor <r> <g> <b> <datasetName>
    54 pseudocolor linewidth <val> <datasetName>
    55 pseudocolor visible <bool> <datasetName>
    56 
    57 contour2d add numcontours <n> <datasetName>
    58 contour2d add contourlist <list> <datasetName>
    59           list = {isoval1 isoval2 isoval3...}
    60 contour2d delete <datasetName>
    61 contour2d linecolor <r> <g> <b> <datasetName>
    62 contour2d linewidth <val> <datasetName>
    63 contour2d visible <bool> <datasetName>
    64 
    65 polydata add <datasetName>
    66 polydata color <r> <g> <b> <datasetName>
    67 polydata delete <datasetName>
    68 polydata edges <bool> <datasetName>
    69 polydata linecolor <r> <g> <b> <datasetName>
    70 polydata linewidth <val> <datasetName>
    71 polydata visible <bool> <datasetName>
    72 polydata wireframe <bool> <datasetName>
     69polydata add <?datasetName?>
     70polydata color <r> <g> <b> <?datasetName?>
     71polydata delete <?datasetName?>
     72polydata edges <bool> <?datasetName?>
     73polydata lighting <bool> <?datasetName?>
     74polydata linecolor <r> <g> <b> <?datasetName?>
     75polydata linewidth <val> <?datasetName?>
     76polydata opacity <val> <?datasetName?>
     77polydata visible <bool> <?datasetName?>
     78polydata wireframe <bool> <?datasetName?>
    7379
    7480================================================================================
Note: See TracChangeset for help on using the changeset viewer.