Ignore:
Timestamp:
Mar 15, 2011 10:58:51 AM (13 years ago)
Author:
ldelgass
Message:

Finish up making dataset name optional (meaning "all") in vtkvis protocol.

Location:
trunk/packages/vizservers/vtkvis
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/vtkvis/RpContour2D.cpp

    r2123 r2137  
    4545        update();
    4646    }
     47}
     48
     49/**
     50 * \brief Returns the DataSet this Contour2D renders
     51 */
     52DataSet *Contour2D::getDataSet()
     53{
     54    return _dataSet;
    4755}
    4856
  • trunk/packages/vizservers/vtkvis/RpContour2D.h

    r2114 r2137  
    3030
    3131    void setDataSet(DataSet *dataset);
     32
     33    DataSet *getDataSet();
    3234
    3335    vtkActor *getActor();
  • trunk/packages/vizservers/vtkvis/RpPolyData.cpp

    r2123 r2137  
    8585
    8686/**
     87 * \brief Returns the DataSet this PolyData renders
     88 */
     89DataSet *PolyData::getDataSet()
     90{
     91    return _dataSet;
     92}
     93
     94/**
    8795 * \brief Internal method to re-compute contours after a state change
    8896 */
  • trunk/packages/vizservers/vtkvis/RpPolyData.h

    r2114 r2137  
    2929
    3030    void setDataSet(DataSet *dataset);
     31
     32    DataSet *getDataSet();
    3133
    3234    vtkActor *getActor();
  • trunk/packages/vizservers/vtkvis/RpPseudoColor.cpp

    r2123 r2137  
    4646    _dataSet = dataSet;
    4747    update();
     48}
     49
     50/**
     51 * \brief Returns the DataSet this PseudoColor renders
     52 */
     53DataSet *PseudoColor::getDataSet()
     54{
     55    return _dataSet;
    4856}
    4957
  • trunk/packages/vizservers/vtkvis/RpPseudoColor.h

    r2114 r2137  
    3131
    3232    void setDataSet(DataSet *dataset);
     33
     34    DataSet *getDataSet();
    3335
    3436    vtkActor *getActor();
  • trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp

    r2124 r2137  
    697697void Renderer::addPseudoColor(const DataSetId& id)
    698698{
    699     DataSet *ds = getDataSet(id);
    700     if (ds == NULL)
    701         return;
    702 
    703     if (getPseudoColor(id)) {
    704         WARN("Replacing existing pseudocolor %s", id.c_str());
    705         deletePseudoColor(id);
    706     }
    707     PseudoColor *pc = new PseudoColor();
    708     _pseudoColors[id] = pc;
    709 
    710     pc->setDataSet(ds);
    711 
    712     _renderer->AddActor(pc->getActor());
     699    DataSetHashmap::iterator itr;
     700
     701    bool doAll = false;
     702
     703    if (id.compare("all") == 0) {
     704        itr = _dataSets.begin();
     705    } else {
     706        itr = _dataSets.find(id);
     707    }
     708    if (itr == _dataSets.end()) {
     709        ERROR("Unknown dataset %s", id.c_str());
     710        return;
     711    }
     712
     713    do {
     714        DataSet *ds = itr->second;
     715        const DataSetId& dsID = ds->getName();
     716
     717        if (getPseudoColor(dsID)) {
     718            WARN("Replacing existing pseudocolor %s", dsID.c_str());
     719            deletePseudoColor(dsID);
     720        }
     721        PseudoColor *pc = new PseudoColor();
     722        _pseudoColors[dsID] = pc;
     723
     724        pc->setDataSet(ds);
     725
     726        _renderer->AddActor(pc->getActor());
     727    } while (doAll && ++itr != _dataSets.end());
    713728
    714729    initCamera();
     
    735750void Renderer::setPseudoColorColorMap(const DataSetId& id, const ColorMapId& colorMapId)
    736751{
    737     PseudoColor *pc = getPseudoColor(id);
    738     if (pc) {
    739         ColorMap *cmap = getColorMap(colorMapId);
    740         if (cmap) {
    741             TRACE("Set color map: %s for dataset %s", colorMapId.c_str(),
    742                   id.c_str());
    743             pc->setLookupTable(cmap->getLookupTable());
    744              _needsRedraw = true;
    745         } else {
    746             ERROR("Unknown colormap: %s", colorMapId.c_str());
    747         }
    748     } else {
    749         ERROR("No pseudocolor for dataset %s", id.c_str());
    750     }
     752    PseudoColorHashmap::iterator itr;
     753
     754    bool doAll = false;
     755
     756    if (id.compare("all") == 0) {
     757        itr = _pseudoColors.begin();
     758        doAll = true;
     759    } else {
     760        itr = _pseudoColors.find(id);
     761    }
     762
     763    if (itr == _pseudoColors.end()) {
     764        ERROR("PseudoColor not found: %s", id.c_str());
     765        return;
     766    }
     767
     768    ColorMap *cmap = getColorMap(colorMapId);
     769    if (cmap == NULL) {
     770        ERROR("Unknown colormap: %s", colorMapId.c_str());
     771        return;
     772    }
     773
     774    do {
     775        TRACE("Set color map: %s for dataset %s", colorMapId.c_str(),
     776              itr->second->getDataSet()->getName().c_str());
     777
     778        itr->second->setLookupTable(cmap->getLookupTable());
     779    } while (doAll && ++itr != _pseudoColors.end());
     780
     781    _needsRedraw = true;
    751782}
    752783
     
    766797
    767798/**
     799 * \brief Set opacity of the PseudoColor for the given DataSet
     800 */
     801void Renderer::setPseudoColorOpacity(const DataSetId& id, double opacity)
     802{
     803    PseudoColorHashmap::iterator itr;
     804
     805    bool doAll = false;
     806
     807    if (id.compare("all") == 0) {
     808        itr = _pseudoColors.begin();
     809        doAll = true;
     810    } else {
     811        itr = _pseudoColors.find(id);
     812    }
     813
     814    if (itr == _pseudoColors.end()) {
     815        ERROR("PseudoColor not found: %s", id.c_str());
     816        return;
     817    }
     818
     819    do {
     820        itr->second->setOpacity(opacity);
     821    } while (doAll && ++itr != _pseudoColors.end());
     822
     823    _needsRedraw = true;
     824}
     825
     826/**
    768827 * \brief Turn on/off rendering of the PseudoColor mapper for the given DataSet
    769828 */
    770829void Renderer::setPseudoColorVisibility(const DataSetId& id, bool state)
    771830{
    772     PseudoColor *pc = getPseudoColor(id);
    773     if (pc) {
    774         pc->setVisibility(state);
    775         _needsRedraw = true;
    776     }
     831    PseudoColorHashmap::iterator itr;
     832
     833    bool doAll = false;
     834
     835    if (id.compare("all") == 0) {
     836        itr = _pseudoColors.begin();
     837        doAll = true;
     838    } else {
     839        itr = _pseudoColors.find(id);
     840    }
     841
     842    if (itr == _pseudoColors.end()) {
     843        ERROR("PseudoColor not found: %s", id.c_str());
     844        return;
     845    }
     846
     847    do {
     848        itr->second->setVisibility(state);
     849    } while (doAll && ++itr != _pseudoColors.end());
     850
     851    _needsRedraw = true;
    777852}
    778853
     
    782857void Renderer::setPseudoColorEdgeVisibility(const DataSetId& id, bool state)
    783858{
    784     PseudoColor *pc = getPseudoColor(id);
    785     if (pc) {
    786         pc->setEdgeVisibility(state);
    787         _needsRedraw = true;
    788     }
     859    PseudoColorHashmap::iterator itr;
     860
     861    bool doAll = false;
     862
     863    if (id.compare("all") == 0) {
     864        itr = _pseudoColors.begin();
     865        doAll = true;
     866    } else {
     867        itr = _pseudoColors.find(id);
     868    }
     869
     870    if (itr == _pseudoColors.end()) {
     871        ERROR("PseudoColor not found: %s", id.c_str());
     872        return;
     873    }
     874
     875    do {
     876        itr->second->setEdgeVisibility(state);
     877    } while (doAll && ++itr != _pseudoColors.end());
     878
     879    _needsRedraw = true;
    789880}
    790881
     
    794885void Renderer::setPseudoColorEdgeColor(const DataSetId& id, float color[3])
    795886{
    796     PseudoColor *pc = getPseudoColor(id);
    797     if (pc) {
    798         pc->setEdgeColor(color);
    799         _needsRedraw = true;
    800     }
     887    PseudoColorHashmap::iterator itr;
     888
     889    bool doAll = false;
     890
     891    if (id.compare("all") == 0) {
     892        itr = _pseudoColors.begin();
     893        doAll = true;
     894    } else {
     895        itr = _pseudoColors.find(id);
     896    }
     897
     898    if (itr == _pseudoColors.end()) {
     899        ERROR("PseudoColor not found: %s", id.c_str());
     900        return;
     901    }
     902
     903    do {
     904        itr->second->setEdgeColor(color);
     905    } while (doAll && ++itr != _pseudoColors.end());
     906
     907    _needsRedraw = true;
    801908}
    802909
     
    809916void Renderer::setPseudoColorEdgeWidth(const DataSetId& id, float edgeWidth)
    810917{
    811     PseudoColor *pc = getPseudoColor(id);
    812     if (pc) {
    813         pc->setEdgeWidth(edgeWidth);
    814         _needsRedraw = true;
    815     }
     918    PseudoColorHashmap::iterator itr;
     919
     920    bool doAll = false;
     921
     922    if (id.compare("all") == 0) {
     923        itr = _pseudoColors.begin();
     924        doAll = true;
     925    } else {
     926        itr = _pseudoColors.find(id);
     927    }
     928
     929    if (itr == _pseudoColors.end()) {
     930        ERROR("PseudoColor not found: %s", id.c_str());
     931        return;
     932    }
     933
     934    do {
     935        itr->second->setEdgeWidth(edgeWidth);
     936    } while (doAll && ++itr != _pseudoColors.end());
     937
     938    _needsRedraw = true;
    816939}
    817940
     
    821944void Renderer::setPseudoColorLighting(const DataSetId& id, bool state)
    822945{
    823     PseudoColor *pc = getPseudoColor(id);
    824     if (pc) {
    825         pc->setLighting(state);
    826         _needsRedraw = true;
    827     }
     946    PseudoColorHashmap::iterator itr;
     947
     948    bool doAll = false;
     949
     950    if (id.compare("all") == 0) {
     951        itr = _pseudoColors.begin();
     952        doAll = true;
     953    } else {
     954        itr = _pseudoColors.find(id);
     955    }
     956
     957    if (itr == _pseudoColors.end()) {
     958        ERROR("PseudoColor not found: %s", id.c_str());
     959        return;
     960    }
     961
     962    do {
     963        itr->second->setLighting(state);
     964    } while (doAll && ++itr != _pseudoColors.end());
     965
     966    _needsRedraw = true;
    828967}
    829968
     
    833972void Renderer::addContour2D(const DataSetId& id)
    834973{
    835     DataSet *ds = getDataSet(id);
    836     if (ds == NULL)
    837         return;
    838 
    839     if (getContour2D(id)) {
    840         WARN("Replacing existing contour2d %s", id.c_str());
    841         deleteContour2D(id);
    842     }
    843 
    844     Contour2D *contour = new Contour2D();
    845     _contours[id] = contour;
    846 
    847     contour->setDataSet(ds);
    848 
    849     _renderer->AddActor(contour->getActor());
     974    DataSetHashmap::iterator itr;
     975
     976    bool doAll = false;
     977
     978    if (id.compare("all") == 0) {
     979        itr = _dataSets.begin();
     980    } else {
     981        itr = _dataSets.find(id);
     982    }
     983    if (itr == _dataSets.end()) {
     984        ERROR("Unknown dataset %s", id.c_str());
     985        return;
     986    }
     987
     988    do {
     989        DataSet *ds = itr->second;
     990        const DataSetId& dsID = ds->getName();
     991
     992        if (getContour2D(dsID)) {
     993            WARN("Replacing existing contour2d %s", dsID.c_str());
     994            deleteContour2D(dsID);
     995        }
     996
     997        Contour2D *contour = new Contour2D();
     998        _contours[dsID] = contour;
     999
     1000        contour->setDataSet(ds);
     1001
     1002        _renderer->AddActor(contour->getActor());
     1003    } while (doAll && ++itr != _dataSets.end());
    8501004
    8511005    initCamera();
     
    8721026void Renderer::setContours(const DataSetId& id, int numContours)
    8731027{
    874     Contour2D *contour = getContour2D(id);
    875     if (contour) {
    876         contour->setContours(numContours);
    877         _needsRedraw = true;
    878     }
     1028    Contour2DHashmap::iterator itr;
     1029
     1030    bool doAll = false;
     1031
     1032    if (id.compare("all") == 0) {
     1033        itr = _contours.begin();
     1034        doAll = true;
     1035    } else {
     1036        itr = _contours.find(id);
     1037    }
     1038    if (itr == _contours.end()) {
     1039        ERROR("Contour2D not found: %s", id.c_str());
     1040        return;
     1041    }
     1042
     1043    do {
     1044        itr->second->setContours(numContours);
     1045    } while (doAll && ++itr != _contours.end());
     1046
     1047    _needsRedraw = true;
    8791048}
    8801049
     
    8841053void Renderer::setContourList(const DataSetId& id, const std::vector<double>& contours)
    8851054{
    886     Contour2D *contour = getContour2D(id);
    887     if (contour) {
    888         contour->setContourList(contours);
    889         _needsRedraw = true;
    890     }
     1055    Contour2DHashmap::iterator itr;
     1056
     1057    bool doAll = false;
     1058
     1059    if (id.compare("all") == 0) {
     1060        itr = _contours.begin();
     1061        doAll = true;
     1062    } else {
     1063        itr = _contours.find(id);
     1064    }
     1065    if (itr == _contours.end()) {
     1066        ERROR("Contour2D not found: %s", id.c_str());
     1067        return;
     1068    }
     1069
     1070    do {
     1071        itr->second->setContourList(contours);
     1072    } while (doAll && ++itr != _contours.end());
     1073
     1074     _needsRedraw = true;
     1075}
     1076
     1077/**
     1078 * \brief Set opacity of contour lines for the given DataSet
     1079 */
     1080void Renderer::setContourOpacity(const DataSetId& id, double opacity)
     1081{
     1082    Contour2DHashmap::iterator itr;
     1083
     1084    bool doAll = false;
     1085
     1086    if (id.compare("all") == 0) {
     1087        itr = _contours.begin();
     1088        doAll = true;
     1089    } else {
     1090        itr = _contours.find(id);
     1091    }
     1092    if (itr == _contours.end()) {
     1093        ERROR("Contour2D not found: %s", id.c_str());
     1094        return;
     1095    }
     1096
     1097    do {
     1098        itr->second->setOpacity(opacity);
     1099    } while (doAll && ++itr != _contours.end());
     1100
     1101    _needsRedraw = true;
    8911102}
    8921103
     
    8961107void Renderer::setContourVisibility(const DataSetId& id, bool state)
    8971108{
    898     Contour2D *contour = getContour2D(id);
    899     if (contour) {
    900         contour->setVisibility(state);
    901         _needsRedraw = true;
    902     }
     1109    Contour2DHashmap::iterator itr;
     1110
     1111    bool doAll = false;
     1112
     1113    if (id.compare("all") == 0) {
     1114        itr = _contours.begin();
     1115        doAll = true;
     1116    } else {
     1117        itr = _contours.find(id);
     1118    }
     1119    if (itr == _contours.end()) {
     1120        ERROR("Contour2D not found: %s", id.c_str());
     1121        return;
     1122    }
     1123
     1124    do {
     1125        itr->second->setVisibility(state);
     1126    } while (doAll && ++itr != _contours.end());
     1127
     1128    _needsRedraw = true;
    9031129}
    9041130
     
    9081134void Renderer::setContourEdgeColor(const DataSetId& id, float color[3])
    9091135{
    910     Contour2D *contour = getContour2D(id);
    911     if (contour) {
    912         contour->setEdgeColor(color);
    913         _needsRedraw = true;
    914     }
     1136    Contour2DHashmap::iterator itr;
     1137
     1138    bool doAll = false;
     1139
     1140    if (id.compare("all") == 0) {
     1141        itr = _contours.begin();
     1142        doAll = true;
     1143    } else {
     1144        itr = _contours.find(id);
     1145    }
     1146    if (itr == _contours.end()) {
     1147        ERROR("Contour2D not found: %s", id.c_str());
     1148        return;
     1149    }
     1150
     1151    do {
     1152        itr->second->setEdgeColor(color);
     1153    } while (doAll && ++itr != _contours.end());
     1154
     1155    _needsRedraw = true;
    9151156}
    9161157
     
    9231164void Renderer::setContourEdgeWidth(const DataSetId& id, float edgeWidth)
    9241165{
    925     Contour2D *contour = getContour2D(id);
    926     if (contour) {
    927         contour->setEdgeWidth(edgeWidth);
    928         _needsRedraw = true;
    929     }
     1166    Contour2DHashmap::iterator itr;
     1167
     1168    bool doAll = false;
     1169
     1170    if (id.compare("all") == 0) {
     1171        itr = _contours.begin();
     1172        doAll = true;
     1173    } else {
     1174        itr = _contours.find(id);
     1175    }
     1176    if (itr == _contours.end()) {
     1177        ERROR("Contour2D not found: %s", id.c_str());
     1178        return;
     1179    }
     1180
     1181    do {
     1182        itr->second->setEdgeWidth(edgeWidth);
     1183    } while (doAll && ++itr != _contours.end());
     1184
     1185    _needsRedraw = true;
    9301186}
    9311187
     
    9351191void Renderer::setContourLighting(const DataSetId& id, bool state)
    9361192{
    937     Contour2D *contour = getContour2D(id);
    938     if (contour) {
    939         contour->setLighting(state);
    940         _needsRedraw = true;
    941     }
     1193    Contour2DHashmap::iterator itr;
     1194
     1195    bool doAll = false;
     1196
     1197    if (id.compare("all") == 0) {
     1198        itr = _contours.begin();
     1199        doAll = true;
     1200    } else {
     1201        itr = _contours.find(id);
     1202    }
     1203    if (itr == _contours.end()) {
     1204        ERROR("Contour2D not found: %s", id.c_str());
     1205        return;
     1206    }
     1207
     1208    do {
     1209        itr->second->setLighting(state);
     1210    } while (doAll && ++itr != _contours.end());
     1211    _needsRedraw = true;
    9421212}
    9431213
     
    9471217void Renderer::addPolyData(const DataSetId& id)
    9481218{
    949     DataSet *ds = getDataSet(id);
    950     if (ds == NULL)
    951         return;
    952 
    953     if (getPolyData(id)) {
    954         WARN("Replacing existing polydata %s", id.c_str());
    955         deletePolyData(id);
    956     }
    957 
    958     PolyData *polyData = new PolyData();
    959     _polyDatas[id] = polyData;
    960 
    961     polyData->setDataSet(ds);
    962 
    963     _renderer->AddActor(polyData->getActor());
     1219    DataSetHashmap::iterator itr;
     1220
     1221    bool doAll = false;
     1222
     1223    if (id.compare("all") == 0) {
     1224        itr = _dataSets.begin();
     1225    } else {
     1226        itr = _dataSets.find(id);
     1227    }
     1228    if (itr == _dataSets.end()) {
     1229        ERROR("Unknown dataset %s", id.c_str());
     1230        return;
     1231    }
     1232
     1233    do {
     1234        DataSet *ds = itr->second;
     1235        const DataSetId& dsID = ds->getName();
     1236
     1237        if (getPolyData(dsID)) {
     1238            WARN("Replacing existing polydata %s", dsID.c_str());
     1239            deletePolyData(dsID);
     1240        }
     1241
     1242        PolyData *polyData = new PolyData();
     1243        _polyDatas[dsID] = polyData;
     1244
     1245        polyData->setDataSet(ds);
     1246
     1247        _renderer->AddActor(polyData->getActor());
     1248    } while (doAll && ++itr != _dataSets.end());
    9641249
    9651250    if (_cameraMode == IMAGE)
     
    9841269
    9851270/**
     1271 * \brief Set opacity of the PolyData for the given DataSet
     1272 */
     1273void Renderer::setPolyDataOpacity(const DataSetId& id, double opacity)
     1274{
     1275    PolyDataHashmap::iterator itr;
     1276   
     1277    bool doAll = false;
     1278
     1279    if (id.compare("all") == 0) {
     1280        itr = _polyDatas.begin();
     1281        doAll = true;
     1282    } else {
     1283        itr = _polyDatas.find(id);
     1284    }
     1285    if (itr == _polyDatas.end()) {
     1286        ERROR("PolyData not found: %s", id.c_str());
     1287        return;
     1288    }
     1289
     1290    do {
     1291        itr->second->setOpacity(opacity);
     1292    } while (doAll && ++itr != _polyDatas.end());
     1293
     1294    _needsRedraw = true;
     1295}
     1296
     1297/**
    9861298 * \brief Turn on/off rendering of the PolyData mapper for the given DataSet
    9871299 */
    9881300void Renderer::setPolyDataVisibility(const DataSetId& id, bool state)
    9891301{
    990     PolyData *polyData = getPolyData(id);
    991     if (polyData) {
    992         polyData->setVisibility(state);
    993         _needsRedraw = true;
    994     }
     1302    PolyDataHashmap::iterator itr;
     1303   
     1304    bool doAll = false;
     1305
     1306    if (id.compare("all") == 0) {
     1307        itr = _polyDatas.begin();
     1308        doAll = true;
     1309    } else {
     1310        itr = _polyDatas.find(id);
     1311    }
     1312    if (itr == _polyDatas.end()) {
     1313        ERROR("PolyData not found: %s", id.c_str());
     1314        return;
     1315    }
     1316
     1317    do {
     1318        itr->second->setVisibility(state);
     1319    } while (doAll && ++itr != _polyDatas.end());
     1320
     1321    _needsRedraw = true;
    9951322}
    9961323
     
    10001327void Renderer::setPolyDataColor(const DataSetId& id, float color[3])
    10011328{
    1002     PolyData *polyData = getPolyData(id);
    1003     if (polyData) {
    1004         polyData->setColor(color);
    1005         _needsRedraw = true;
    1006     }
     1329    PolyDataHashmap::iterator itr;
     1330   
     1331    bool doAll = false;
     1332
     1333    if (id.compare("all") == 0) {
     1334        itr = _polyDatas.begin();
     1335        doAll = true;
     1336    } else {
     1337        itr = _polyDatas.find(id);
     1338    }
     1339    if (itr == _polyDatas.end()) {
     1340        ERROR("PolyData not found: %s", id.c_str());
     1341        return;
     1342    }
     1343
     1344    do {
     1345        itr->second->setColor(color);
     1346    } while (doAll && ++itr != _polyDatas.end());
     1347    _needsRedraw = true;
    10071348}
    10081349
     
    10121353void Renderer::setPolyDataEdgeVisibility(const DataSetId& id, bool state)
    10131354{
    1014     PolyData *polyData = getPolyData(id);
    1015     if (polyData) {
    1016         polyData->setEdgeVisibility(state);
    1017         _needsRedraw = true;
    1018     }
     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->setEdgeVisibility(state);
     1372    } while (doAll && ++itr != _polyDatas.end());
     1373
     1374    _needsRedraw = true;
    10191375}
    10201376
     
    10241380void Renderer::setPolyDataEdgeColor(const DataSetId& id, float color[3])
    10251381{
    1026     PolyData *polyData = getPolyData(id);
    1027     if (polyData) {
    1028         polyData->setEdgeColor(color);
    1029         _needsRedraw = true;
    1030     }
     1382    PolyDataHashmap::iterator itr;
     1383   
     1384    bool doAll = false;
     1385
     1386    if (id.compare("all") == 0) {
     1387        itr = _polyDatas.begin();
     1388        doAll = true;
     1389    } else {
     1390        itr = _polyDatas.find(id);
     1391    }
     1392    if (itr == _polyDatas.end()) {
     1393        ERROR("PolyData not found: %s", id.c_str());
     1394        return;
     1395    }
     1396
     1397    do {
     1398        itr->second->setEdgeColor(color);
     1399    } while (doAll && ++itr != _polyDatas.end());
     1400
     1401    _needsRedraw = true;
    10311402}
    10321403
     
    10391410void Renderer::setPolyDataEdgeWidth(const DataSetId& id, float edgeWidth)
    10401411{
    1041     PolyData *polyData = getPolyData(id);
    1042     if (polyData) {
    1043         polyData->setEdgeWidth(edgeWidth);
    1044         _needsRedraw = true;
    1045     }
     1412    PolyDataHashmap::iterator itr;
     1413   
     1414    bool doAll = false;
     1415
     1416    if (id.compare("all") == 0) {
     1417        itr = _polyDatas.begin();
     1418        doAll = true;
     1419    } else {
     1420        itr = _polyDatas.find(id);
     1421    }
     1422    if (itr == _polyDatas.end()) {
     1423        ERROR("PolyData not found: %s", id.c_str());
     1424        return;
     1425    }
     1426
     1427    do {
     1428        itr->second->setEdgeWidth(edgeWidth);
     1429    } while (doAll && ++itr != _polyDatas.end());
     1430
     1431    _needsRedraw = true;
    10461432}
    10471433
     
    10511437void Renderer::setPolyDataWireframe(const DataSetId& id, bool state)
    10521438{
    1053     PolyData *polyData = getPolyData(id);
    1054     if (polyData) {
    1055         polyData->setWireframe(state);
    1056         _needsRedraw = true;
    1057     }
     1439    PolyDataHashmap::iterator itr;
     1440   
     1441    bool doAll = false;
     1442
     1443    if (id.compare("all") == 0) {
     1444        itr = _polyDatas.begin();
     1445        doAll = true;
     1446    } else {
     1447        itr = _polyDatas.find(id);
     1448    }
     1449    if (itr == _polyDatas.end()) {
     1450        ERROR("PolyData not found: %s", id.c_str());
     1451        return;
     1452    }
     1453
     1454    do {
     1455        itr->second->setWireframe(state);
     1456    } while (doAll && ++itr != _polyDatas.end());
     1457
     1458    _needsRedraw = true;
    10581459}
    10591460
     
    10631464void Renderer::setPolyDataLighting(const DataSetId& id, bool state)
    10641465{
    1065     PolyData *polyData = getPolyData(id);
    1066     if (polyData) {
    1067         polyData->setLighting(state);
    1068         _needsRedraw = true;
    1069     }
     1466    PolyDataHashmap::iterator itr;
     1467   
     1468    bool doAll = false;
     1469
     1470    if (id.compare("all") == 0) {
     1471        itr = _polyDatas.begin();
     1472        doAll = true;
     1473    } else {
     1474        itr = _polyDatas.find(id);
     1475    }
     1476    if (itr == _polyDatas.end()) {
     1477        ERROR("PolyData not found: %s", id.c_str());
     1478        return;
     1479    }
     1480
     1481    do {
     1482        itr->second->setLighting(state);
     1483    } while (doAll && ++itr != _polyDatas.end());
     1484
     1485    _needsRedraw = true;
    10701486}
    10711487
     
    14571873void Renderer::setOpacity(const DataSetId& id, double opacity)
    14581874{
    1459     PseudoColor *pc = getPseudoColor(id);
    1460     if (pc) {
    1461         pc->setOpacity(opacity);
    1462         _needsRedraw = true;
    1463     }
    1464     Contour2D *contour = getContour2D(id);
    1465     if (contour) {
    1466         contour->setOpacity(opacity);
    1467         _needsRedraw = true;
    1468     }
    1469     PolyData *polyData = getPolyData(id);
    1470     if (polyData) {
    1471         polyData->setOpacity(opacity);
    1472         _needsRedraw = true;
    1473     }
     1875    setPseudoColorOpacity(id, opacity);
     1876    setContourOpacity(id, opacity);
     1877    setPolyDataOpacity(id, opacity);
    14741878}
    14751879
  • trunk/packages/vizservers/vtkvis/RpVtkRenderer.h

    r2123 r2137  
    154154    vtkLookupTable *getPseudoColorColorMap(const DataSetId& id);
    155155
     156    void setPseudoColorOpacity(const DataSetId& id, double opacity);
     157
    156158    void setPseudoColorVisibility(const DataSetId& id, bool state);
    157159
     
    175177
    176178    void setContourList(const DataSetId& id, const std::vector<double>& contours);
     179
     180    void setContourOpacity(const DataSetId& id, double opacity);
    177181
    178182    void setContourVisibility(const DataSetId& id, bool state);
     
    191195
    192196    PolyData *getPolyData(const DataSetId& id);
     197
     198    void setPolyDataOpacity(const DataSetId& id, double opacity);
    193199
    194200    void setPolyDataVisibility(const DataSetId& id, bool state);
  • trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp

    r2124 r2137  
    433433                          Tcl_Obj *const *objv)
    434434{
    435     const char *name = Tcl_GetString(objv[4]);
    436     g_renderer->addContour2D(name);
    437435    std::vector<double> contourList;
    438436
     
    452450    }
    453451
    454     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    }
    455460    return TCL_OK;
    456461}
     
    460465                          Tcl_Obj *const *objv)
    461466{
    462     const char *name = Tcl_GetString(objv[4]);
    463     g_renderer->addContour2D(name);
    464467    int numContours;
    465468    if (Tcl_GetIntFromObj(interp, objv[3], &numContours) != TCL_OK) {
    466469        return TCL_ERROR;
    467470    }
    468     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    }
    469479    return TCL_OK;
    470480}
    471481
    472482static Rappture::CmdSpec contour2dAddOps[] = {
    473     {"contourlist", 1, Contour2DAddContourListOp, 5, 5, "contourList dataSetName"},
    474     {"numcontours", 1, Contour2DAddNumContoursOp, 5, 5, "numContours dataSetName"}
     483    {"contourlist", 1, Contour2DAddContourListOp, 4, 5, "contourList ?dataSetName?"},
     484    {"numcontours", 1, Contour2DAddNumContoursOp, 4, 5, "numContours ?dataSetName?"}
    475485};
    476486static int nContour2dAddOps = NumCmdSpecs(contour2dAddOps);
     
    507517                    Tcl_Obj *const *objv)
    508518{
    509     const char *name = Tcl_GetString(objv[3]);
    510519    bool state;
    511520    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    512521        return TCL_ERROR;
    513522    }
    514     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    }
    515529    return TCL_OK;
    516530}
     
    520534                     Tcl_Obj *const *objv)
    521535{
    522     const char *name = Tcl_GetString(objv[5]);
    523536    float color[3];
    524537    if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||
     
    527540        return TCL_ERROR;
    528541    }
    529     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    }
    530548    return TCL_OK;
    531549}
     
    535553                     Tcl_Obj *const *objv)
    536554{
    537     const char *name = Tcl_GetString(objv[3]);
    538555    float width;
    539556    if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) {
    540557        return TCL_ERROR;
    541558    }
    542     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    }
    543582    return TCL_OK;
    544583}
     
    548587                   Tcl_Obj *const *objv)
    549588{
    550     const char *name = Tcl_GetString(objv[3]);
    551589    bool state;
    552590    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    553591        return TCL_ERROR;
    554592    }
    555     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    }
    556599    return TCL_OK;
    557600}
    558601
    559602static Rappture::CmdSpec contour2dOps[] = {
    560     {"add", 1, Contour2DAddOp, 5, 5, "oper value dataSetName"},
     603    {"add", 1, Contour2DAddOp, 4, 5, "oper value ?dataSetName?"},
    561604    {"delete", 1, Contour2DDeleteOp, 2, 3, "?dataSetName?"},
    562     {"lighting", 3, Contour2DLightingOp, 4, 4, "bool dataSetName"},
    563     {"linecolor", 5, Contour2DLineColorOp, 6, 6, "r g b dataSetName"},
    564     {"linewidth", 5, Contour2DLineWidthOp, 4, 4, "width dataSetName"},
    565     {"visible", 1, Contour2DVisibleOp, 4, 4, "bool 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?"}
    566610};
    567611static int nContour2dOps = NumCmdSpecs(contour2dOps);
     
    724768                 Tcl_Obj *const *objv)
    725769{
    726     const char *name = Tcl_GetString(objv[3]);
    727770    double opacity;
    728771    if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) {
    729772        return TCL_ERROR;
    730773    }
    731     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    }
    732780    return TCL_OK;
    733781}
     
    737785                 Tcl_Obj *const *objv)
    738786{
    739     const char *name = Tcl_GetString(objv[3]);
    740787    bool state;
    741788    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    742789        return TCL_ERROR;
    743790    }
    744     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    }
    745797    return TCL_OK;
    746798}
     
    750802    {"delete", 1, DataSetDeleteOp, 2, 3, "?name?"},
    751803    {"getvalue", 1, DataSetGetValueOp, 6, 7, "oper x y ?z? name"},
    752     {"opacity", 1, DataSetOpacityOp, 4, 4, "value name"},
    753     {"visible", 1, DataSetVisibleOp, 4, 4, "bool name"}
     804    {"opacity", 1, DataSetOpacityOp, 3, 4, "value ?name?"},
     805    {"visible", 1, DataSetVisibleOp, 3, 4, "bool ?name?"}
    754806};
    755807static int nDataSetOps = NumCmdSpecs(dataSetOps);
     
    811863               Tcl_Obj *const *objv)
    812864{
    813     const char *name = Tcl_GetString(objv[2]);
    814     g_renderer->addPseudoColor(name);
     865    if (objc == 3) {
     866        const char *name = Tcl_GetString(objv[2]);
     867        g_renderer->addPseudoColor(name);
     868    } else {
     869        g_renderer->addPseudoColor("all");
     870    }
    815871    return TCL_OK;
    816872}
     
    821877{
    822878    const char *colorMapName = Tcl_GetString(objv[2]);
    823     const char *dataSetName = Tcl_GetString(objv[3]);
    824     g_renderer->setPseudoColorColorMap(dataSetName, colorMapName);
     879    if (objc == 4) {
     880        const char *dataSetName = Tcl_GetString(objv[3]);
     881        g_renderer->setPseudoColorColorMap(dataSetName, colorMapName);
     882    } else {
     883        g_renderer->setPseudoColorColorMap("all", colorMapName);
     884    }
    825885    return TCL_OK;
    826886}
     
    840900
    841901static int
    842 PseudoColorVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc,
    843                      Tcl_Obj *const *objv)
    844 {
    845     const char *name = Tcl_GetString(objv[3]);
     902PseudoColorEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc,
     903                            Tcl_Obj *const *objv)
     904{
    846905    bool state;
    847906    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    848907        return TCL_ERROR;
    849908    }
    850     g_renderer->setPseudoColorVisibility(name, state);
    851     return TCL_OK;
    852 }
    853 
    854 static int
    855 PseudoColorEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc,
    856                             Tcl_Obj *const *objv)
    857 {
    858     const char *name = Tcl_GetString(objv[3]);
     909    if (objc == 4) {
     910        const char *name = Tcl_GetString(objv[3]);
     911        g_renderer->setPseudoColorEdgeVisibility(name, state);
     912    } else {
     913        g_renderer->setPseudoColorEdgeVisibility("all", state);
     914    }
     915    return TCL_OK;
     916}
     917
     918static int
     919PseudoColorLightingOp(ClientData clientData, Tcl_Interp *interp, int objc,
     920                      Tcl_Obj *const *objv)
     921{
    859922    bool state;
    860923    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    861924        return TCL_ERROR;
    862925    }
    863     g_renderer->setPseudoColorEdgeVisibility(name, state);
    864     return TCL_OK;
    865 }
    866 
    867 static int
    868 PseudoColorLightingOp(ClientData clientData, Tcl_Interp *interp, int objc,
    869                       Tcl_Obj *const *objv)
    870 {
    871     const char *name = Tcl_GetString(objv[3]);
    872     bool state;
    873     if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    874         return TCL_ERROR;
    875     }
    876     g_renderer->setPseudoColorLighting(name, state);
     926    if (objc == 4) {
     927        const char *name = Tcl_GetString(objv[3]);
     928        g_renderer->setPseudoColorLighting(name, state);
     929    } else {
     930        g_renderer->setPseudoColorLighting("all", state);
     931    }
    877932    return TCL_OK;
    878933}
     
    882937                       Tcl_Obj *const *objv)
    883938{
    884     const char *name = Tcl_GetString(objv[5]);
    885939    float color[3];
    886940    if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||
     
    889943        return TCL_ERROR;
    890944    }
    891     g_renderer->setPseudoColorEdgeColor(name, color);
     945    if (objc == 6) {
     946        const char *name = Tcl_GetString(objv[5]);
     947        g_renderer->setPseudoColorEdgeColor(name, color);
     948    } else {
     949        g_renderer->setPseudoColorEdgeColor("all", color);
     950    }
    892951    return TCL_OK;
    893952}
     
    897956                       Tcl_Obj *const *objv)
    898957{
    899     const char *name = Tcl_GetString(objv[3]);
    900958    float width;
    901959    if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) {
    902960        return TCL_ERROR;
    903961    }
    904     g_renderer->setPseudoColorEdgeWidth(name, width);
     962    if (objc == 4) {
     963        const char *name = Tcl_GetString(objv[3]);
     964        g_renderer->setPseudoColorEdgeWidth(name, width);
     965    } else {
     966        g_renderer->setPseudoColorEdgeWidth("all", width);
     967    }
     968    return TCL_OK;
     969}
     970
     971static int
     972PseudoColorOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc,
     973                     Tcl_Obj *const *objv)
     974{
     975    double opacity;
     976    if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) {
     977        return TCL_ERROR;
     978    }
     979    if (objc == 4) {
     980        const char *name = Tcl_GetString(objv[3]);
     981        g_renderer->setPseudoColorOpacity(name, opacity);
     982    } else {
     983        g_renderer->setPseudoColorOpacity("all", opacity);
     984    }
     985    return TCL_OK;
     986}
     987
     988static int
     989PseudoColorVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc,
     990                     Tcl_Obj *const *objv)
     991{
     992    bool state;
     993    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     994        return TCL_ERROR;
     995    }
     996    if (objc == 4) {
     997        const char *name = Tcl_GetString(objv[3]);
     998        g_renderer->setPseudoColorVisibility(name, state);
     999    } else {
     1000        g_renderer->setPseudoColorVisibility("all", state);
     1001    }
    9051002    return TCL_OK;
    9061003}
    9071004
    9081005static Rappture::CmdSpec pseudoColorOps[] = {
    909     {"add", 1, PseudoColorAddOp, 3, 3, "dataSetName"},
    910     {"colormap", 1, PseudoColorColorMapOp, 4, 4, "colorMapName dataSetName"},
     1006    {"add", 1, PseudoColorAddOp, 2, 3, "?dataSetName?"},
     1007    {"colormap", 1, PseudoColorColorMapOp, 3, 4, "colorMapName ?dataSetName?"},
    9111008    {"delete", 1, PseudoColorDeleteOp, 2, 3, "?dataSetName?"},
    912     {"edges", 1, PseudoColorEdgeVisibilityOp, 4, 4, "bool dataSetName"},
    913     {"lighting", 3, PseudoColorLightingOp, 4, 4, "bool dataSetName"},
    914     {"linecolor", 5, PseudoColorLineColorOp, 6, 6, "r g b dataSetName"},
    915     {"linewidth", 5, PseudoColorLineWidthOp, 4, 4, "width dataSetName"},
    916     {"visible", 1, PseudoColorVisibleOp, 4, 4, "bool dataSetName"}
     1009    {"edges", 1, PseudoColorEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"},
     1010    {"lighting", 3, PseudoColorLightingOp, 3, 4, "bool ?dataSetName?"},
     1011    {"linecolor", 5, PseudoColorLineColorOp, 5, 6, "r g b ?dataSetName?"},
     1012    {"linewidth", 5, PseudoColorLineWidthOp, 3, 4, "width ?dataSetName?"},
     1013    {"opacity", 1, PseudoColorOpacityOp, 3, 4, "value ?dataSetName?"},
     1014    {"visible", 1, PseudoColorVisibleOp, 3, 4, "bool ?dataSetName?"}
    9171015};
    9181016static int nPseudoColorOps = NumCmdSpecs(pseudoColorOps);
     
    9361034              Tcl_Obj *const *objv)
    9371035{
    938     const char *name = Tcl_GetString(objv[2]);
    939     g_renderer->addPolyData(name);
     1036    if (objc == 3) {
     1037        const char *name = Tcl_GetString(objv[2]);
     1038        g_renderer->addPolyData(name);
     1039    } else {
     1040        g_renderer->addPolyData("all");
     1041    }
    9401042    return TCL_OK;
    9411043}
     
    9581060                Tcl_Obj *const *objv)
    9591061{
    960     const char *name = Tcl_GetString(objv[5]);
    9611062    float color[3];
    9621063    if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||
     
    9651066        return TCL_ERROR;
    9661067    }
    967     g_renderer->setPolyDataColor(name, color);
     1068    if (objc == 6) {
     1069        const char *name = Tcl_GetString(objv[5]);
     1070        g_renderer->setPolyDataColor(name, color);
     1071    } else {
     1072        g_renderer->setPolyDataColor("all", color);
     1073    }
    9681074    return TCL_OK;
    9691075}
     
    9731079                         Tcl_Obj *const *objv)
    9741080{
    975     const char *name = Tcl_GetString(objv[3]);
    9761081    bool state;
    9771082    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    9781083        return TCL_ERROR;
    9791084    }
    980     g_renderer->setPolyDataEdgeVisibility(name, state);
     1085    if (objc == 4) {
     1086        const char *name = Tcl_GetString(objv[3]);
     1087        g_renderer->setPolyDataEdgeVisibility(name, state);
     1088    } else {
     1089        g_renderer->setPolyDataEdgeVisibility("all", state);
     1090    }
    9811091    return TCL_OK;
    9821092}
     
    9861096                   Tcl_Obj *const *objv)
    9871097{
    988     const char *name = Tcl_GetString(objv[3]);
    9891098    bool state;
    9901099    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    9911100        return TCL_ERROR;
    9921101    }
    993     g_renderer->setPolyDataLighting(name, state);
     1102    if (objc == 4) {
     1103        const char *name = Tcl_GetString(objv[3]);
     1104        g_renderer->setPolyDataLighting(name, state);
     1105    } else {
     1106        g_renderer->setPolyDataLighting("all", state);
     1107    }
    9941108    return TCL_OK;
    9951109}
     
    9991113                    Tcl_Obj *const *objv)
    10001114{
    1001     const char *name = Tcl_GetString(objv[5]);
    10021115    float color[3];
    10031116    if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||
     
    10061119        return TCL_ERROR;
    10071120    }
    1008     g_renderer->setPolyDataEdgeColor(name, color);
     1121    if (objc == 6) {
     1122        const char *name = Tcl_GetString(objv[5]);
     1123        g_renderer->setPolyDataEdgeColor(name, color);
     1124    } else {
     1125        g_renderer->setPolyDataEdgeColor("all", color);
     1126    }
    10091127    return TCL_OK;
    10101128}
     
    10141132                    Tcl_Obj *const *objv)
    10151133{
    1016     const char *name = Tcl_GetString(objv[3]);
    10171134    float width;
    10181135    if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) {
    10191136        return TCL_ERROR;
    10201137    }
    1021     g_renderer->setPolyDataEdgeWidth(name, width);
     1138    if (objc == 4) {
     1139        const char *name = Tcl_GetString(objv[3]);
     1140        g_renderer->setPolyDataEdgeWidth(name, width);
     1141    } else {
     1142        g_renderer->setPolyDataEdgeWidth("all", width);
     1143    }
     1144    return TCL_OK;
     1145}
     1146
     1147static int
     1148PolyDataOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1149                  Tcl_Obj *const *objv)
     1150{
     1151    double opacity;
     1152    if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) {
     1153        return TCL_ERROR;
     1154    }
     1155    if (objc == 4) {
     1156        const char *name = Tcl_GetString(objv[3]);
     1157        g_renderer->setPolyDataOpacity(name, opacity);
     1158    } else {
     1159        g_renderer->setPolyDataOpacity("all", opacity);
     1160    }
    10221161    return TCL_OK;
    10231162}
     
    10271166                  Tcl_Obj *const *objv)
    10281167{
    1029     const char *name = Tcl_GetString(objv[3]);
    10301168    bool state;
    10311169    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    10321170        return TCL_ERROR;
    10331171    }
    1034     g_renderer->setPolyDataVisibility(name, state);
     1172    if (objc == 4) {
     1173        const char *name = Tcl_GetString(objv[3]);
     1174        g_renderer->setPolyDataVisibility(name, state);
     1175    } else {
     1176        g_renderer->setPolyDataVisibility("all", state);
     1177    }
    10351178    return TCL_OK;
    10361179}
     
    10401183                    Tcl_Obj *const *objv)
    10411184{
    1042     const char *name = Tcl_GetString(objv[3]);
    10431185    bool state;
    10441186    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    10451187        return TCL_ERROR;
    10461188    }
    1047     g_renderer->setPolyDataWireframe(name, state);
     1189    if (objc == 4) {
     1190        const char *name = Tcl_GetString(objv[3]);
     1191        g_renderer->setPolyDataWireframe(name, state);
     1192    } else {
     1193        g_renderer->setPolyDataWireframe("all", state);
     1194    }
    10481195    return TCL_OK;
    10491196}
    10501197
    10511198static Rappture::CmdSpec polyDataOps[] = {
    1052     {"add", 1, PolyDataAddOp, 3, 3, "dataSetName"},
    1053     {"color", 1, PolyDataColorOp, 6, 6, "r g b dataSetName"},
     1199    {"add", 1, PolyDataAddOp, 2, 3, "?dataSetName?"},
     1200    {"color", 1, PolyDataColorOp, 5, 6, "r g b ?dataSetName?"},
    10541201    {"delete", 1, PolyDataDeleteOp, 2, 3, "?dataSetName?"},
    1055     {"edges", 1, PolyDataEdgeVisibilityOp, 4, 4, "bool dataSetName"},
    1056     {"lighting", 3, PolyDataLightingOp, 4, 4, "bool dataSetName"},
    1057     {"linecolor", 5, PolyDataLineColorOp, 6, 6, "r g b dataSetName"},
    1058     {"linewidth", 5, PolyDataLineWidthOp, 4, 4, "width dataSetName"},
    1059     {"visible", 1, PolyDataVisibleOp, 4, 4, "bool dataSetName"},
    1060     {"wireframe", 1, PolyDataWireframeOp, 4, 4, "bool dataSetName"}
     1202    {"edges", 1, PolyDataEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"},
     1203    {"lighting", 3, PolyDataLightingOp, 3, 4, "bool ?dataSetName?"},
     1204    {"linecolor", 5, PolyDataLineColorOp, 5, 6, "r g b ?dataSetName?"},
     1205    {"linewidth", 5, PolyDataLineWidthOp, 3, 4, "width ?dataSetName?"},
     1206    {"opacity", 1, PolyDataOpacityOp, 3, 4, "value ?dataSetName?"},
     1207    {"visible", 1, PolyDataVisibleOp, 3, 4, "bool ?dataSetName?"},
     1208    {"wireframe", 1, PolyDataWireframeOp, 3, 4, "bool ?dataSetName?"}
    10611209};
    10621210static int nPolyDataOps = NumCmdSpecs(polyDataOps);
  • trunk/packages/vizservers/vtkvis/protocol.txt

    r2124 r2137  
    4444dataset getvalue pixel <x> <y> <datasetName>
    4545        Use pixel for image camera mode
    46 dataset opacity <val> <datasetName>
    47 dataset visible <bool> <datasetName>
     46dataset opacity <val> <?datasetName?>
     47dataset visible <bool> <?datasetName?>
    4848
    49 pseudocolor add <datasetName>
    50 pseudocolor colormap <colormapName> <datasetName>
     49pseudocolor add <?datasetName?>
     50pseudocolor colormap <colormapName> <?datasetName?>
    5151pseudocolor delete <?datasetName?>
    52 pseudocolor edges <bool> <datasetName>
    53 pseudocolor linecolor <r> <g> <b> <datasetName>
    54 pseudocolor linewidth <val> <datasetName>
    55 pseudocolor visible <bool> <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?>
    5658
    57 contour2d add numcontours <n> <datasetName>
    58 contour2d add contourlist <list> <datasetName>
     59contour2d add numcontours <n> <?datasetName?>
     60contour2d add contourlist <list> <?datasetName?>
    5961          list = {isoval1 isoval2 isoval3...}
    6062contour2d delete <?datasetName?>
    61 contour2d linecolor <r> <g> <b> <datasetName>
    62 contour2d linewidth <val> <datasetName>
    63 contour2d visible <bool> <datasetName>
     63contour2d lighting <bool> <?datasetName?>
     64contour2d linecolor <r> <g> <b> <?datasetName?>
     65contour2d linewidth <val> <?datasetName?>
     66contour2d opacity <val> <?datasetName?>
     67contour2d visible <bool> <?datasetName?>
    6468
    65 polydata add <datasetName>
    66 polydata color <r> <g> <b> <datasetName>
     69polydata add <?datasetName?>
     70polydata color <r> <g> <b> <?datasetName?>
    6771polydata 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>
     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.