- Timestamp:
- Mar 8, 2011, 2:43:17 PM (14 years ago)
- Location:
- trunk/packages/vizservers/vtkvis
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/CmdProc.cpp
r2100 r2123 22 22 */ 23 23 static int 24 BinaryOpSearch( 25 Rappture::CmdSpec *specs, 26 int nSpecs, 27 char *string) /* Name of minor operation to search for */ 24 BinaryOpSearch(Rappture::CmdSpec *specs, 25 int nSpecs, 26 char *string) /* Name of minor operation to search for */ 28 27 { 29 28 char c; … … 77 76 */ 78 77 static int 79 LinearOpSearch( 80 Rappture::CmdSpec *specs, 81 int nSpecs, 82 char *string) /* Name of minor operation to search for */ 78 LinearOpSearch(Rappture::CmdSpec *specs, 79 int nSpecs, 80 char *string) /* Name of minor operation to search for */ 83 81 { 84 82 Rappture::CmdSpec *specPtr; … … 93 91 last = -1; 94 92 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 } 103 101 } 104 102 if (nMatches > 1) { 105 return -2; /* Ambiguous operation name */103 return -2; /* Ambiguous operation name */ 106 104 } 107 105 if (nMatches == 0) { 108 return -1; /* Can't find operation */106 return -1; /* Can't find operation */ 109 107 } 110 108 return last; /* Op found. */ … … 122 120 */ 123 121 Tcl_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) 122 Rappture::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) 135 132 { 136 133 CmdSpec *specPtr; … … 139 136 140 137 if (objc <= operPos) { /* No operation argument */ 141 Tcl_AppendResult(interp, "wrong # args: ", (char *)NULL);142 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); 139 usage: 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; 157 154 } 158 155 string = Tcl_GetString(objv[operPos]); 159 156 if (flags & CMDSPEC_LINEAR_SEARCH) { 160 n = LinearOpSearch(specs, nSpecs, string);157 n = LinearOpSearch(specs, nSpecs, string); 161 158 } else { 162 n = BinaryOpSearch(specs, nSpecs, string);159 n = BinaryOpSearch(specs, nSpecs, string); 163 160 } 164 161 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; 186 183 187 184 } 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; 195 192 } 196 193 specPtr = specs + n; 197 194 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; 209 206 } 210 207 return specPtr->proc; -
trunk/packages/vizservers/vtkvis/CmdProc.h
r2100 r2123 20 20 */ 21 21 typedef 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 */ 24 24 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 */ 28 28 } CmdSpec; 29 29 30 30 typedef 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. */ 36 36 } CmdSpecIndex; 37 37 -
trunk/packages/vizservers/vtkvis/RpContour2D.cpp
r2121 r2123 11 11 12 12 #include "RpContour2D.h" 13 #include "Trace.h" 13 14 14 15 using namespace Rappture::VtkVis; … … 27 28 Contour2D::~Contour2D() 28 29 { 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 29 36 } 30 37 -
trunk/packages/vizservers/vtkvis/RpPolyData.cpp
r2121 r2123 32 32 PolyData::~PolyData() 33 33 { 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 34 40 } 35 41 -
trunk/packages/vizservers/vtkvis/RpPseudoColor.cpp
r2121 r2123 29 29 PseudoColor::~PseudoColor() 30 30 { 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 31 37 } 32 38 -
trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp
r2121 r2123 30 30 31 31 #include "RpVtkRenderer.h" 32 #include "ColorMap.h" 32 33 #include "Trace.h" 33 34 … … 86 87 } 87 88 _colorMaps.clear(); 88 for (DataSetHashmap::iterator itr = _dataSets.begin();89 itr != _dataSets.end(); ++itr) {90 delete itr->second;91 }92 _dataSets.clear();93 89 for (PseudoColorHashmap::iterator itr = _pseudoColors.begin(); 94 90 itr != _pseudoColors.end(); ++itr) { … … 106 102 } 107 103 _polyDatas.clear(); 104 for (DataSetHashmap::iterator itr = _dataSets.begin(); 105 itr != _dataSets.end(); ++itr) { 106 delete itr->second; 107 } 108 _dataSets.clear(); 108 109 } 109 110 … … 115 116 * be added to the Renderer. 116 117 */ 117 void Renderer::addDataSet( DataSetIdid)118 void Renderer::addDataSet(const DataSetId& id) 118 119 { 119 120 if (getDataSet(id) != NULL) { … … 129 130 * The underlying PseudoColor object is deleted, freeing its memory 130 131 */ 131 void Renderer::deletePseudoColor(DataSetId id) 132 { 133 PseudoColorHashmap::iterator itr = _pseudoColors.find(id); 132 void Renderer::deletePseudoColor(const DataSetId& id) 133 { 134 PseudoColorHashmap::iterator itr; 135 136 bool doAll = false; 137 138 if (id.compare("all") == 0) { 139 itr = _pseudoColors.begin(); 140 doAll = true; 141 } else { 142 itr = _pseudoColors.find(id); 143 } 134 144 if (itr == _pseudoColors.end()) { 135 145 ERROR("PseudoColor not found: %s", id.c_str()); … … 139 149 TRACE("Deleting PseudoColors for %s", id.c_str()); 140 150 141 PseudoColor *ps = itr->second; 142 if (ps->getActor()) 143 _renderer->RemoveActor(ps->getActor()); 144 delete ps; 145 146 _pseudoColors.erase(itr); 151 do { 152 PseudoColor *ps = itr->second; 153 if (ps->getActor()) 154 _renderer->RemoveActor(ps->getActor()); 155 delete ps; 156 157 _pseudoColors.erase(itr); 158 } while (doAll && ++itr != _pseudoColors.end()); 159 147 160 _needsRedraw = true; 148 161 } … … 153 166 * The underlying Contour2D is deleted, freeing its memory 154 167 */ 155 void Renderer::deleteContour2D(DataSetId id) 156 { 157 Contour2DHashmap::iterator itr = _contours.find(id); 168 void Renderer::deleteContour2D(const DataSetId& id) 169 { 170 Contour2DHashmap::iterator itr; 171 172 bool doAll = false; 173 174 if (id.compare("all") == 0) { 175 itr = _contours.begin(); 176 doAll = true; 177 } else { 178 itr = _contours.find(id); 179 } 158 180 if (itr == _contours.end()) { 159 181 ERROR("Contour2D not found: %s", id.c_str()); … … 163 185 TRACE("Deleting Contour2Ds for %s", id.c_str()); 164 186 165 Contour2D *contour = itr->second; 166 if (contour->getActor()) 167 _renderer->RemoveActor(contour->getActor()); 168 delete contour; 169 170 _contours.erase(itr); 187 do { 188 Contour2D *contour = itr->second; 189 if (contour->getActor()) 190 _renderer->RemoveActor(contour->getActor()); 191 delete contour; 192 193 _contours.erase(itr); 194 } while (doAll && ++itr != _contours.end()); 195 171 196 _needsRedraw = true; 172 197 } … … 177 202 * The underlying PolyData is deleted, freeing its memory 178 203 */ 179 void Renderer::deletePolyData(DataSetId id) 180 { 181 PolyDataHashmap::iterator itr = _polyDatas.find(id); 204 void Renderer::deletePolyData(const DataSetId& id) 205 { 206 PolyDataHashmap::iterator itr; 207 208 bool doAll = false; 209 210 if (id.compare("all") == 0) { 211 itr = _polyDatas.begin(); 212 doAll = true; 213 } else { 214 itr = _polyDatas.find(id); 215 } 182 216 if (itr == _polyDatas.end()) { 183 217 ERROR("PolyData not found: %s", id.c_str()); … … 187 221 TRACE("Deleting PolyDatas for %s", id.c_str()); 188 222 189 PolyData *polyData = itr->second; 190 if (polyData->getActor()) 191 _renderer->RemoveActor(polyData->getActor()); 192 delete polyData; 193 194 _polyDatas.erase(itr); 223 do { 224 PolyData *polyData = itr->second; 225 if (polyData->getActor()) 226 _renderer->RemoveActor(polyData->getActor()); 227 delete polyData; 228 229 _polyDatas.erase(itr); 230 } while (doAll && ++itr != _polyDatas.end()); 231 195 232 _needsRedraw = true; 196 233 } … … 202 239 * objects are deleted, freeing the memory used. 203 240 */ 204 void Renderer::deleteDataSet(DataSetId id) 205 { 206 DataSetHashmap::iterator itr = _dataSets.find(id); 241 void Renderer::deleteDataSet(const DataSetId& id) 242 { 243 DataSetHashmap::iterator itr; 244 245 bool doAll = false; 246 247 if (id.compare("all") == 0) { 248 itr = _dataSets.begin(); 249 doAll = true; 250 } else { 251 itr = _dataSets.find(id); 252 } 207 253 if (itr == _dataSets.end()) { 208 254 ERROR("Unknown dataset %s", id.c_str()); 209 255 return; 210 } else { 211 TRACE("Deleting dataset %s", id.c_str()); 212 213 deletePseudoColor(id); 214 deleteContour2D(id); 215 deletePolyData(id); 216 256 } 257 258 do { 259 TRACE("Deleting dataset %s", itr->second->getName().c_str()); 260 261 deletePseudoColor(itr->second->getName()); 262 deleteContour2D(itr->second->getName()); 263 deletePolyData(itr->second->getName()); 264 217 265 TRACE("After deleting graphics objects"); 218 266 … … 222 270 delete itr->second; 223 271 _dataSets.erase(itr); 224 _needsRedraw = true; 225 } 272 } while (doAll && ++itr != _dataSets.end()); 273 274 _needsRedraw = true; 226 275 } 227 276 … … 231 280 * \return A pointer to the DataSet, or NULL if not found 232 281 */ 233 DataSet *Renderer::getDataSet( DataSetIdid)282 DataSet *Renderer::getDataSet(const DataSetId& id) 234 283 { 235 284 DataSetHashmap::iterator itr = _dataSets.find(id); … … 244 293 * \brief (Re-)load the data for the specified DataSet key from a file 245 294 */ 246 bool Renderer::setDataFile( DataSetIdid, const char *filename)295 bool Renderer::setDataFile(const DataSetId& id, const char *filename) 247 296 { 248 297 DataSet *ds = getDataSet(id); … … 262 311 * \brief (Re-)load the data for the specified DataSet key from a memory buffer 263 312 */ 264 bool Renderer::setData( DataSetIdid, char *data, int nbytes)313 bool Renderer::setData(const DataSetId& id, char *data, int nbytes) 265 314 { 266 315 DataSet *ds = getDataSet(id); … … 525 574 * \brief Add a color map for use in the Renderer 526 575 */ 527 void Renderer::addColorMap( ColorMapIdid, ColorMap *colorMap)576 void Renderer::addColorMap(const ColorMapId& id, ColorMap *colorMap) 528 577 { 529 578 if (colorMap != NULL) { … … 542 591 * \brief Return the ColorMap associated with the colormap key given 543 592 */ 544 ColorMap *Renderer::getColorMap( ColorMapIdid)593 ColorMap *Renderer::getColorMap(const ColorMapId& id) 545 594 { 546 595 ColorMapHashmap::iterator itr = _colorMaps.find(id); … … 558 607 * by any other objects 559 608 */ 560 void Renderer::deleteColorMap( ColorMapIdid)609 void Renderer::deleteColorMap(const ColorMapId& id) 561 610 { 562 611 ColorMapHashmap::iterator itr = _colorMaps.find(id); … … 572 621 * \brief Render a labelled legend image for the given colormap 573 622 * 574 * \return The image is rendered into the supplied array 575 */ 576 void Renderer::renderColorMap(ColorMapId id, const char *title, 623 * \return The image is rendered into the supplied array, false is 624 * returned if the color map is not found 625 */ 626 bool Renderer::renderColorMap(const ColorMapId& id, const char *title, 577 627 int width, int height, 578 628 vtkUnsignedCharArray *imgData) 579 629 { 630 ColorMap *colorMap = getColorMap(id); 631 if (colorMap == NULL) 632 return false; 633 580 634 if (_legendRenderWindow == NULL) { 581 635 _legendRenderWindow = vtkSmartPointer<vtkRenderWindow>::New(); … … 597 651 _legendRenderer->AddActor(_scalarBarActor); 598 652 } 599 _scalarBarActor->SetLookupTable( getColorMap(id)->getLookupTable());653 _scalarBarActor->SetLookupTable(colorMap->getLookupTable()); 600 654 // Set viewport-relative width/height/pos 601 655 if (width > height) { … … 619 673 620 674 _legendRenderWindow->GetPixelData(0, 0, width-1, height-1, 1, imgData); 675 return true; 621 676 } 622 677 … … 624 679 * \brief Create a new PseudoColor rendering for the specified DataSet 625 680 */ 626 void Renderer::addPseudoColor( DataSetIdid)681 void Renderer::addPseudoColor(const DataSetId& id) 627 682 { 628 683 DataSet *ds = getDataSet(id); … … 648 703 * \brief Get the PseudoColor associated with the specified DataSet 649 704 */ 650 PseudoColor *Renderer::getPseudoColor( DataSetIdid)705 PseudoColor *Renderer::getPseudoColor(const DataSetId& id) 651 706 { 652 707 PseudoColorHashmap::iterator itr = _pseudoColors.find(id); … … 662 717 * \brief Associate an existing named color map with a DataSet 663 718 */ 664 void Renderer::setPseudoColorColorMap( DataSetId id, ColorMapIdcolorMapId)719 void Renderer::setPseudoColorColorMap(const DataSetId& id, const ColorMapId& colorMapId) 665 720 { 666 721 PseudoColor *pc = getPseudoColor(id); … … 685 740 * \return The associated lookup table or NULL if not found 686 741 */ 687 vtkLookupTable *Renderer::getPseudoColorColorMap( DataSetIdid)742 vtkLookupTable *Renderer::getPseudoColorColorMap(const DataSetId& id) 688 743 { 689 744 PseudoColor *pc = getPseudoColor(id); … … 697 752 * \brief Turn on/off rendering of the PseudoColor mapper for the given DataSet 698 753 */ 699 void Renderer::setPseudoColorVisibility( DataSetIdid, bool state)754 void Renderer::setPseudoColorVisibility(const DataSetId& id, bool state) 700 755 { 701 756 PseudoColor *pc = getPseudoColor(id); … … 709 764 * \brief Set the visibility of polygon edges for the specified DataSet 710 765 */ 711 void Renderer::setPseudoColorEdgeVisibility( DataSetIdid, bool state)766 void Renderer::setPseudoColorEdgeVisibility(const DataSetId& id, bool state) 712 767 { 713 768 PseudoColor *pc = getPseudoColor(id); … … 721 776 * \brief Set the RGB polygon edge color for the specified DataSet 722 777 */ 723 void Renderer::setPseudoColorEdgeColor( DataSetIdid, float color[3])778 void Renderer::setPseudoColorEdgeColor(const DataSetId& id, float color[3]) 724 779 { 725 780 PseudoColor *pc = getPseudoColor(id); … … 736 791 * this function may not have an effect. 737 792 */ 738 void Renderer::setPseudoColorEdgeWidth( DataSetIdid, float edgeWidth)793 void Renderer::setPseudoColorEdgeWidth(const DataSetId& id, float edgeWidth) 739 794 { 740 795 PseudoColor *pc = getPseudoColor(id); … … 748 803 * \brief Turn mesh lighting on/off for the specified DataSet 749 804 */ 750 void Renderer::setPseudoColorLighting( DataSetIdid, bool state)805 void Renderer::setPseudoColorLighting(const DataSetId& id, bool state) 751 806 { 752 807 PseudoColor *pc = getPseudoColor(id); … … 760 815 * \brief Create a new Contour2D and associate it with the named DataSet 761 816 */ 762 void Renderer::addContour2D( DataSetIdid)817 void Renderer::addContour2D(const DataSetId& id) 763 818 { 764 819 DataSet *ds = getDataSet(id); … … 785 840 * \brief Get the Contour2D associated with a named DataSet 786 841 */ 787 Contour2D *Renderer::getContour2D( DataSetIdid)842 Contour2D *Renderer::getContour2D(const DataSetId& id) 788 843 { 789 844 Contour2DHashmap::iterator itr = _contours.find(id); … … 799 854 * \brief Set the number of equally spaced contour isolines for the given DataSet 800 855 */ 801 void Renderer::setContours( DataSetIdid, int numContours)856 void Renderer::setContours(const DataSetId& id, int numContours) 802 857 { 803 858 Contour2D *contour = getContour2D(id); … … 811 866 * \brief Set a list of isovalues for the given DataSet 812 867 */ 813 void Renderer::setContourList( DataSetIdid, const std::vector<double>& contours)868 void Renderer::setContourList(const DataSetId& id, const std::vector<double>& contours) 814 869 { 815 870 Contour2D *contour = getContour2D(id); … … 823 878 * \brief Turn on/off rendering contour lines for the given DataSet 824 879 */ 825 void Renderer::setContourVisibility( DataSetIdid, bool state)880 void Renderer::setContourVisibility(const DataSetId& id, bool state) 826 881 { 827 882 Contour2D *contour = getContour2D(id); … … 835 890 * \brief Set the RGB isoline color for the specified DataSet 836 891 */ 837 void Renderer::setContourEdgeColor( DataSetIdid, float color[3])892 void Renderer::setContourEdgeColor(const DataSetId& id, float color[3]) 838 893 { 839 894 Contour2D *contour = getContour2D(id); … … 850 905 * this function may not have an effect. 851 906 */ 852 void Renderer::setContourEdgeWidth( DataSetIdid, float edgeWidth)907 void Renderer::setContourEdgeWidth(const DataSetId& id, float edgeWidth) 853 908 { 854 909 Contour2D *contour = getContour2D(id); … … 862 917 * \brief Turn contour lighting on/off for the specified DataSet 863 918 */ 864 void Renderer::setContourLighting( DataSetIdid, bool state)919 void Renderer::setContourLighting(const DataSetId& id, bool state) 865 920 { 866 921 Contour2D *contour = getContour2D(id); … … 874 929 * \brief Create a new PolyData and associate it with the named DataSet 875 930 */ 876 void Renderer::addPolyData( DataSetIdid)931 void Renderer::addPolyData(const DataSetId& id) 877 932 { 878 933 DataSet *ds = getDataSet(id); … … 901 956 * \brief Get the PolyData associated with a named DataSet 902 957 */ 903 PolyData *Renderer::getPolyData( DataSetIdid)958 PolyData *Renderer::getPolyData(const DataSetId& id) 904 959 { 905 960 PolyDataHashmap::iterator itr = _polyDatas.find(id); … … 915 970 * \brief Turn on/off rendering of the PolyData mapper for the given DataSet 916 971 */ 917 void Renderer::setPolyDataVisibility( DataSetIdid, bool state)972 void Renderer::setPolyDataVisibility(const DataSetId& id, bool state) 918 973 { 919 974 PolyData *polyData = getPolyData(id); … … 927 982 * \brief Set the RGB polygon face color for the specified DataSet 928 983 */ 929 void Renderer::setPolyDataColor( DataSetIdid, float color[3])984 void Renderer::setPolyDataColor(const DataSetId& id, float color[3]) 930 985 { 931 986 PolyData *polyData = getPolyData(id); … … 939 994 * \brief Set the visibility of polygon edges for the specified DataSet 940 995 */ 941 void Renderer::setPolyDataEdgeVisibility( DataSetIdid, bool state)996 void Renderer::setPolyDataEdgeVisibility(const DataSetId& id, bool state) 942 997 { 943 998 PolyData *polyData = getPolyData(id); … … 951 1006 * \brief Set the RGB polygon edge color for the specified DataSet 952 1007 */ 953 void Renderer::setPolyDataEdgeColor( DataSetIdid, float color[3])1008 void Renderer::setPolyDataEdgeColor(const DataSetId& id, float color[3]) 954 1009 { 955 1010 PolyData *polyData = getPolyData(id); … … 966 1021 * this function may not have an effect. 967 1022 */ 968 void Renderer::setPolyDataEdgeWidth( DataSetIdid, float edgeWidth)1023 void Renderer::setPolyDataEdgeWidth(const DataSetId& id, float edgeWidth) 969 1024 { 970 1025 PolyData *polyData = getPolyData(id); … … 978 1033 * \brief Set wireframe rendering for the specified DataSet 979 1034 */ 980 void Renderer::setPolyDataWireframe( DataSetIdid, bool state)1035 void Renderer::setPolyDataWireframe(const DataSetId& id, bool state) 981 1036 { 982 1037 PolyData *polyData = getPolyData(id); … … 990 1045 * \brief Turn mesh lighting on/off for the specified DataSet 991 1046 */ 992 void Renderer::setPolyDataLighting( DataSetIdid, bool state)1047 void Renderer::setPolyDataLighting(const DataSetId& id, bool state) 993 1048 { 994 1049 PolyData *polyData = getPolyData(id); … … 1384 1439 * \brief Set the opacity of the specified DataSet's associated graphics objects 1385 1440 */ 1386 void Renderer::setOpacity( DataSetIdid, double opacity)1441 void Renderer::setOpacity(const DataSetId& id, double opacity) 1387 1442 { 1388 1443 PseudoColor *pc = getPseudoColor(id); … … 1406 1461 * \brief Turn on/off rendering of the specified DataSet's associated graphics objects 1407 1462 */ 1408 void Renderer::setVisibility( DataSetIdid, bool state)1463 void Renderer::setVisibility(const DataSetId& id, bool state) 1409 1464 { 1410 1465 setPseudoColorVisibility(id, state); … … 1482 1537 * Note: no interpolation is performed on data 1483 1538 */ 1484 double Renderer::getDataValueAtPixel( DataSetIdid, int x, int y)1539 double Renderer::getDataValueAtPixel(const DataSetId& id, int x, int y) 1485 1540 { 1486 1541 vtkSmartPointer<vtkCoordinate> coord = vtkSmartPointer<vtkCoordinate>::New(); … … 1504 1559 * Note: no interpolation is performed on data 1505 1560 */ 1506 double Renderer::getDataValue( DataSetIdid, double x, double y, double z)1561 double Renderer::getDataValue(const DataSetId& id, double x, double y, double z) 1507 1562 { 1508 1563 DataSet *ds = getDataSet(id); -
trunk/packages/vizservers/vtkvis/RpVtkRenderer.h
r2121 r2123 66 66 // Data sets 67 67 68 void addDataSet( DataSetIdid);69 70 void deleteDataSet( DataSetIdid);71 72 DataSet *getDataSet( DataSetIdid);73 74 bool setData( DataSetIdid, char *data, int nbytes);75 76 bool setDataFile( DataSetIdid, const char *filename);77 78 double getDataValueAtPixel( DataSetIdid, int x, int y);79 80 double getDataValue( DataSetIdid, double x, double y, double z);81 82 void setOpacity( DataSetIdid, double opacity);83 84 void setVisibility( DataSetIdid, 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); 85 85 86 86 // Render window … … 132 132 // Colormaps 133 133 134 void addColorMap( ColorMapIdid, ColorMap *colorMap);135 136 void deleteColorMap( ColorMapIdid);137 138 ColorMap *getColorMap( ColorMapIdid);139 140 void renderColorMap(ColorMapIdid, 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, const char *title, 141 141 int width, int height, 142 142 vtkUnsignedCharArray *imgData); … … 144 144 // Color-mapped surfaces 145 145 146 void addPseudoColor( DataSetIdid);147 148 void deletePseudoColor( DataSetIdid);149 150 PseudoColor *getPseudoColor( DataSetIdid);151 152 void setPseudoColorColorMap( DataSetId id, ColorMapIdcolorMapId);153 154 vtkLookupTable *getPseudoColorColorMap( DataSetIdid);155 156 void setPseudoColorVisibility( DataSetIdid, bool state);157 158 void setPseudoColorEdgeVisibility( DataSetIdid, bool state);159 160 void setPseudoColorEdgeColor( DataSetIdid, float color[3]);161 162 void setPseudoColorEdgeWidth( DataSetIdid, float edgeWidth);163 164 void setPseudoColorLighting( DataSetIdid, bool state);146 void addPseudoColor(const DataSetId& id); 147 148 void deletePseudoColor(const DataSetId& id); 149 150 PseudoColor *getPseudoColor(const DataSetId& id); 151 152 void setPseudoColorColorMap(const DataSetId& id, const ColorMapId& colorMapId); 153 154 vtkLookupTable *getPseudoColorColorMap(const DataSetId& id); 155 156 void setPseudoColorVisibility(const DataSetId& id, bool state); 157 158 void setPseudoColorEdgeVisibility(const DataSetId& id, bool state); 159 160 void setPseudoColorEdgeColor(const DataSetId& id, float color[3]); 161 162 void setPseudoColorEdgeWidth(const DataSetId& id, float edgeWidth); 163 164 void setPseudoColorLighting(const DataSetId& id, bool state); 165 165 166 166 // Contour plots 167 167 168 void addContour2D( DataSetIdid);169 170 void deleteContour2D( DataSetIdid);171 172 Contour2D *getContour2D( DataSetIdid);173 174 void setContours( DataSetIdid, int numContours);175 176 void setContourList( DataSetIdid, const std::vector<double>& contours);177 178 void setContourVisibility( DataSetIdid, bool state);179 180 void setContourEdgeColor( DataSetIdid, float color[3]);181 182 void setContourEdgeWidth( DataSetIdid, float edgeWidth);183 184 void setContourLighting( DataSetIdid, bool state);168 void addContour2D(const DataSetId& id); 169 170 void deleteContour2D(const DataSetId& id); 171 172 Contour2D *getContour2D(const DataSetId& id); 173 174 void setContours(const DataSetId& id, int numContours); 175 176 void setContourList(const DataSetId& id, const std::vector<double>& contours); 177 178 void setContourVisibility(const DataSetId& id, bool state); 179 180 void setContourEdgeColor(const DataSetId& id, float color[3]); 181 182 void setContourEdgeWidth(const DataSetId& id, float edgeWidth); 183 184 void setContourLighting(const DataSetId& id, bool state); 185 185 186 186 // Meshes 187 187 188 void addPolyData( DataSetIdid);188 void addPolyData(const DataSetId& id); 189 189 190 void deletePolyData( DataSetIdid);191 192 PolyData *getPolyData( DataSetIdid);193 194 void setPolyDataVisibility( DataSetIdid, bool state);195 196 void setPolyDataColor( DataSetIdid, float color[3]);197 198 void setPolyDataEdgeVisibility( DataSetIdid, bool state);199 200 void setPolyDataEdgeColor( DataSetIdid, float color[3]);201 202 void setPolyDataEdgeWidth( DataSetIdid, float edgeWidth);203 204 void setPolyDataWireframe( DataSetIdid, bool state);205 206 void setPolyDataLighting( DataSetIdid, bool state);190 void deletePolyData(const DataSetId& id); 191 192 PolyData *getPolyData(const DataSetId& id); 193 194 void setPolyDataVisibility(const DataSetId& id, bool state); 195 196 void setPolyDataColor(const DataSetId& id, float color[3]); 197 198 void setPolyDataEdgeVisibility(const DataSetId& id, bool state); 199 200 void setPolyDataEdgeColor(const DataSetId& id, float color[3]); 201 202 void setPolyDataEdgeWidth(const DataSetId& id, float edgeWidth); 203 204 void setPolyDataWireframe(const DataSetId& id, bool state); 205 206 void setPolyDataLighting(const DataSetId& id, bool state); 207 207 208 208 private: -
trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp
r2115 r2123 172 172 {"name", 1, AxisNameOp, 4, 4, "axis title"}, 173 173 {"units", 1, AxisUnitsOp, 4, 4, "axis units"}, 174 {"visible", 1, AxisVisibleOp, 4, 4, "axis bool"} ,174 {"visible", 1, AxisVisibleOp, 4, 4, "axis bool"} 175 175 }; 176 176 static int nAxisOps = NumCmdSpecs(axisOps); … … 298 298 {"reset", 2, CameraResetOp, 2, 3, "?all?"}, 299 299 {"rotate", 2, CameraRotateOp, 5, 5, "angle angle angle"}, 300 {"zoom", 1, CameraZoomOp, 3, 3, "zoomAmount"} ,300 {"zoom", 1, CameraZoomOp, 3, 3, "zoomAmount"} 301 301 }; 302 302 static int nCameraOps = NumCmdSpecs(cameraOps); … … 490 490 Tcl_Obj *const *objv) 491 491 { 492 const char *name = Tcl_GetString(objv[2]); 493 g_renderer->deleteContour2D(name); 492 if (objc == 3) { 493 const char *name = Tcl_GetString(objv[2]); 494 g_renderer->deleteContour2D(name); 495 } else { 496 g_renderer->deleteContour2D("all"); 497 } 494 498 return TCL_OK; 495 499 } … … 551 555 static Rappture::CmdSpec contour2dOps[] = { 552 556 {"add", 1, Contour2DAddOp, 5, 5, "oper value dataSetName"}, 553 {"delete", 1, Contour2DDeleteOp, 3, 3, "dataSetName"},557 {"delete", 1, Contour2DDeleteOp, 2, 3, "?dataSetName?"}, 554 558 {"lighting", 3, Contour2DLightingOp, 4, 4, "bool dataSetName"}, 555 559 {"linecolor", 5, Contour2DLineColorOp, 6, 6, "r g b dataSetName"}, 556 560 {"linewidth", 5, Contour2DLineWidthOp, 4, 4, "width dataSetName"}, 557 {"visible", 1, Contour2DVisibleOp, 4, 4, "bool dataSetName"} ,561 {"visible", 1, Contour2DVisibleOp, 4, 4, "bool dataSetName"} 558 562 }; 559 563 static int nContour2dOps = NumCmdSpecs(contour2dOps); … … 627 631 Tcl_Obj *const *objv) 628 632 { 629 const char *name = Tcl_GetString(objv[2]); 630 TRACE("Deleting dataset %s", name); 631 g_renderer->deleteDataSet(name); 633 if (objc == 3) { 634 const char *name = Tcl_GetString(objv[2]); 635 TRACE("Deleting dataset %s", name); 636 g_renderer->deleteDataSet(name); 637 } else { 638 g_renderer->deleteDataSet("all"); 639 } 632 640 return TCL_OK; 633 641 } … … 736 744 static Rappture::CmdSpec dataSetOps[] = { 737 745 {"add", 1, DataSetAddOp, 6, 6, "name data follows nBytes"}, 738 {"delete", 1, DataSetDeleteOp, 3, 3, "name"},746 {"delete", 1, DataSetDeleteOp, 2, 3, "?name?"}, 739 747 {"getvalue", 1, DataSetGetValueOp, 6, 7, "oper x y ?z? name"}, 740 748 {"opacity", 1, DataSetOpacityOp, 4, 4, "value name"}, … … 778 786 vtkSmartPointer<vtkUnsignedCharArray>::New(); 779 787 780 g_renderer->renderColorMap(name, title, width, height, imgData); 788 if (!g_renderer->renderColorMap(name, title, width, height, imgData)) { 789 Tcl_AppendResult(interp, "Color map \"", 790 name, "\" was not found", (char*)NULL); 791 return TCL_ERROR; 792 } 781 793 782 794 #ifdef DEBUG … … 814 826 Tcl_Obj *const *objv) 815 827 { 816 const char *name = Tcl_GetString(objv[2]); 817 g_renderer->deletePseudoColor(name); 828 if (objc == 3) { 829 const char *name = Tcl_GetString(objv[2]); 830 g_renderer->deletePseudoColor(name); 831 } else { 832 g_renderer->deletePseudoColor("all"); 833 } 818 834 return TCL_OK; 819 835 } … … 889 905 {"add", 1, PseudoColorAddOp, 3, 3, "dataSetName"}, 890 906 {"colormap", 1, PseudoColorColorMapOp, 4, 4, "colorMapName dataSetName"}, 891 {"delete", 1, PseudoColorDeleteOp, 3, 3, "dataSetName"},907 {"delete", 1, PseudoColorDeleteOp, 2, 3, "?dataSetName?"}, 892 908 {"edges", 1, PseudoColorEdgeVisibilityOp, 4, 4, "bool dataSetName"}, 893 909 {"lighting", 3, PseudoColorLightingOp, 4, 4, "bool dataSetName"}, … … 925 941 Tcl_Obj *const *objv) 926 942 { 927 const char *name = Tcl_GetString(objv[2]); 928 g_renderer->deletePolyData(name); 943 if (objc == 3) { 944 const char *name = Tcl_GetString(objv[2]); 945 g_renderer->deletePolyData(name); 946 } else { 947 g_renderer->deletePolyData("all"); 948 } 929 949 return TCL_OK; 930 950 } … … 1028 1048 {"add", 1, PolyDataAddOp, 3, 3, "dataSetName"}, 1029 1049 {"color", 1, PolyDataColorOp, 6, 6, "r g b dataSetName"}, 1030 {"delete", 1, PolyDataDeleteOp, 3, 3, "dataSetName"},1050 {"delete", 1, PolyDataDeleteOp, 2, 3, "?dataSetName?"}, 1031 1051 {"edges", 1, PolyDataEdgeVisibilityOp, 4, 4, "bool dataSetName"}, 1032 1052 {"lighting", 3, PolyDataLightingOp, 4, 4, "bool dataSetName"},
Note: See TracChangeset
for help on using the changeset viewer.