Changeset 2170 for branches/blt4/packages/vizservers
- Timestamp:
- Mar 30, 2011, 12:34:02 PM (13 years ago)
- Location:
- branches/blt4/packages/vizservers
- Files:
-
- 2 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/packages/vizservers/configure.in
r2120 r2170 315 315 LD_RPATH="$loader_run_path:${CG_DIR}/lib" 316 316 fi 317 AC_SUBST(LIBS) 317 318 318 AC_SUBST(CG_DIR) 319 319 AC_MSG_RESULT([${CG_DIR}]) -
branches/blt4/packages/vizservers/vtkvis/CmdProc.cpp
r2120 r2170 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; -
branches/blt4/packages/vizservers/vtkvis/CmdProc.h
r2120 r2170 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 -
branches/blt4/packages/vizservers/vtkvis/RpContour2D.cpp
r2120 r2170 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 … … 38 45 update(); 39 46 } 47 } 48 49 /** 50 * \brief Returns the DataSet this Contour2D renders 51 */ 52 DataSet *Contour2D::getDataSet() 53 { 54 return _dataSet; 40 55 } 41 56 … … 59 74 _contourActor->GetProperty()->SetLineWidth(_edgeWidth); 60 75 _contourActor->GetProperty()->SetOpacity(_opacity); 76 _contourActor->GetProperty()->LightingOff(); 61 77 } 62 78 } … … 76 92 vtkSmartPointer<vtkContourFilter> contourFilter = vtkSmartPointer<vtkContourFilter>::New(); 77 93 contourFilter->SetInput(_dataSet->getVtkDataSet()); 94 95 contourFilter->ComputeNormalsOff(); 96 contourFilter->ComputeGradientsOff(); 78 97 79 98 // Speed up multiple contour computation at cost of extra memory use … … 193 212 { 194 213 if (_contourMapper != NULL) { 195 if (planes == NULL) 196 _contourMapper->RemoveAllClippingPlanes(); 197 else 198 _contourMapper->SetClippingPlanes(planes); 214 _contourMapper->SetClippingPlanes(planes); 199 215 } 200 216 } -
branches/blt4/packages/vizservers/vtkvis/RpContour2D.h
r2120 r2170 30 30 31 31 void setDataSet(DataSet *dataset); 32 33 DataSet *getDataSet(); 32 34 33 35 vtkActor *getActor(); -
branches/blt4/packages/vizservers/vtkvis/RpPolyData.cpp
r2120 r2170 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 … … 79 85 80 86 /** 87 * \brief Returns the DataSet this PolyData renders 88 */ 89 DataSet *PolyData::getDataSet() 90 { 91 return _dataSet; 92 } 93 94 /** 81 95 * \brief Internal method to re-compute contours after a state change 82 96 */ … … 201 215 { 202 216 if (_pdMapper != NULL) { 203 if (planes == NULL) 204 _pdMapper->RemoveAllClippingPlanes(); 205 else 206 _pdMapper->SetClippingPlanes(planes); 217 _pdMapper->SetClippingPlanes(planes); 207 218 } 208 219 } -
branches/blt4/packages/vizservers/vtkvis/RpPolyData.h
r2120 r2170 29 29 30 30 void setDataSet(DataSet *dataset); 31 32 DataSet *getDataSet(); 31 33 32 34 vtkActor *getActor(); -
branches/blt4/packages/vizservers/vtkvis/RpPseudoColor.cpp
r2120 r2170 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 … … 40 46 _dataSet = dataSet; 41 47 update(); 48 } 49 50 /** 51 * \brief Returns the DataSet this PseudoColor renders 52 */ 53 DataSet *PseudoColor::getDataSet() 54 { 55 return _dataSet; 42 56 } 43 57 … … 81 95 _lut->SetRange(dataRange); 82 96 97 _dsMapper->UseLookupTableScalarRangeOn(); 83 98 _dsMapper->SetLookupTable(_lut); 84 _dsMapper->SetScalarRange(dataRange);85 //_dsMapper->GetLookupTable()->SetRange(dataRange);86 99 //_dsMapper->InterpolateScalarsBeforeMappingOn(); 87 100 88 101 initActor(); 89 102 _dsActor->SetMapper(_dsMapper); 90 //_dsActor->GetProperty()->SetRepresentationToWireframe();91 103 } 92 104 … … 149 161 } 150 162 if (_dsMapper != NULL) { 163 _dsMapper->UseLookupTableScalarRangeOn(); 151 164 _dsMapper->SetLookupTable(_lut); 152 if (_dataSet != NULL) {153 _dsMapper->SetScalarRange(dataRange);154 }155 165 } 156 166 } … … 230 240 { 231 241 if (_dsMapper != NULL) { 232 if (planes == NULL) 233 _dsMapper->RemoveAllClippingPlanes(); 234 else 235 _dsMapper->SetClippingPlanes(planes); 242 _dsMapper->SetClippingPlanes(planes); 236 243 } 237 244 } -
branches/blt4/packages/vizservers/vtkvis/RpPseudoColor.h
r2120 r2170 31 31 32 32 void setDataSet(DataSet *dataset); 33 34 DataSet *getDataSet(); 33 35 34 36 vtkActor *getActor(); -
branches/blt4/packages/vizservers/vtkvis/RpVtkDataSet.cpp
r2120 r2170 69 69 70 70 /** 71 * \brief Read dataset using supplied reader 72 */ 73 bool 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 /** 71 84 * \brief Get the name/id of this dataset 72 85 */ … … 97 110 * 98 111 * Note: no interpolation is performed on data 112 * 113 * \return the value of the nearest point or 0 if no scalar data available 99 114 */ 100 115 double DataSet::getDataValue(double x, double y, double z) … … 102 117 if (_dataSet == NULL) 103 118 return 0; 119 if (_dataSet->GetPointData() == NULL || 120 _dataSet->GetPointData()->GetScalars() == NULL) { 121 return 0.0; 122 } 104 123 vtkIdType pt = _dataSet->FindPoint(x, y, z); 105 124 return _dataSet->GetPointData()->GetScalars()->GetComponent(pt, 0); -
branches/blt4/packages/vizservers/vtkvis/RpVtkDataSet.h
r2120 r2170 29 29 bool setData(char *data, int nbytes); 30 30 31 bool setData(vtkDataSet *ds); 32 33 bool setData(vtkDataSetReader *reader); 34 31 35 bool setDataFile(const char *filename); 32 36 … … 42 46 DataSet(); 43 47 44 bool setData(vtkDataSetReader *reader);45 46 48 std::string _name; 47 49 vtkSmartPointer<vtkDataSet> _dataSet; -
branches/blt4/packages/vizservers/vtkvis/RpVtkRenderer.cpp
r2120 r2170 30 30 31 31 #include "RpVtkRenderer.h" 32 #include "ColorMap.h" 32 33 #include "Trace.h" 33 34 … … 37 38 _needsRedraw(true), 38 39 _windowWidth(320), 39 _windowHeight(320) 40 _windowHeight(320), 41 _useCumulativeRanges(true) 40 42 { 41 43 _bgColor[0] = 0; 42 44 _bgColor[1] = 0; 43 45 _bgColor[2] = 0; 46 _cumulativeDataRange[0] = 0.0; 47 _cumulativeDataRange[1] = 1.0; 44 48 // clipping planes to prevent overdrawing axes 45 49 _clippingPlanes = vtkSmartPointer<vtkPlaneCollection>::New(); 46 50 // bottom 47 vtk Plane *plane0 = vtkPlane::New();51 vtkSmartPointer<vtkPlane> plane0 = vtkSmartPointer<vtkPlane>::New(); 48 52 plane0->SetNormal(0, 1, 0); 49 53 plane0->SetOrigin(0, 0, 0); 50 54 _clippingPlanes->AddItem(plane0); 51 55 // left 52 vtk Plane *plane1 = vtkPlane::New();56 vtkSmartPointer<vtkPlane> plane1 = vtkSmartPointer<vtkPlane>::New(); 53 57 plane1->SetNormal(1, 0, 0); 54 58 plane1->SetOrigin(0, 0, 0); 55 59 _clippingPlanes->AddItem(plane1); 56 60 // top 57 vtk Plane *plane2 = vtkPlane::New();61 vtkSmartPointer<vtkPlane> plane2 = vtkSmartPointer<vtkPlane>::New(); 58 62 plane2->SetNormal(0, -1, 0); 59 63 plane2->SetOrigin(0, 1, 0); 60 64 _clippingPlanes->AddItem(plane2); 61 65 // right 62 vtk Plane *plane3 = vtkPlane::New();66 vtkSmartPointer<vtkPlane> plane3 = vtkSmartPointer<vtkPlane>::New(); 63 67 plane3->SetNormal(-1, 0, 0); 64 68 plane3->SetOrigin(1, 0, 0); … … 86 90 } 87 91 _colorMaps.clear(); 88 for (DataSetHashmap::iterator itr = _dataSets.begin();89 itr != _dataSets.end(); ++itr) {90 delete itr->second;91 }92 _dataSets.clear();93 92 for (PseudoColorHashmap::iterator itr = _pseudoColors.begin(); 94 93 itr != _pseudoColors.end(); ++itr) { … … 106 105 } 107 106 _polyDatas.clear(); 107 for (DataSetHashmap::iterator itr = _dataSets.begin(); 108 itr != _dataSets.end(); ++itr) { 109 delete itr->second; 110 } 111 _dataSets.clear(); 108 112 } 109 113 … … 115 119 * be added to the Renderer. 116 120 */ 117 void Renderer::addDataSet( DataSetIdid)121 void Renderer::addDataSet(const DataSetId& id) 118 122 { 119 123 if (getDataSet(id) != NULL) { … … 129 133 * The underlying PseudoColor object is deleted, freeing its memory 130 134 */ 131 void Renderer::deletePseudoColor(DataSetId id) 132 { 133 PseudoColorHashmap::iterator itr = _pseudoColors.find(id); 135 void 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 } 134 147 if (itr == _pseudoColors.end()) { 135 148 ERROR("PseudoColor not found: %s", id.c_str()); … … 139 152 TRACE("Deleting PseudoColors for %s", id.c_str()); 140 153 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 147 163 _needsRedraw = true; 148 164 } … … 153 169 * The underlying Contour2D is deleted, freeing its memory 154 170 */ 155 void Renderer::deleteContour2D(DataSetId id) 156 { 157 Contour2DHashmap::iterator itr = _contours.find(id); 171 void 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 } 158 183 if (itr == _contours.end()) { 159 184 ERROR("Contour2D not found: %s", id.c_str()); … … 163 188 TRACE("Deleting Contour2Ds for %s", id.c_str()); 164 189 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 171 199 _needsRedraw = true; 172 200 } … … 177 205 * The underlying PolyData is deleted, freeing its memory 178 206 */ 179 void Renderer::deletePolyData(DataSetId id) 180 { 181 PolyDataHashmap::iterator itr = _polyDatas.find(id); 207 void 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 } 182 219 if (itr == _polyDatas.end()) { 183 220 ERROR("PolyData not found: %s", id.c_str()); … … 187 224 TRACE("Deleting PolyDatas for %s", id.c_str()); 188 225 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 195 235 _needsRedraw = true; 196 236 } … … 202 242 * objects are deleted, freeing the memory used. 203 243 */ 204 void Renderer::deleteDataSet(DataSetId id) 205 { 206 DataSetHashmap::iterator itr = _dataSets.find(id); 244 void 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 } 207 256 if (itr == _dataSets.end()) { 208 257 ERROR("Unknown dataset %s", id.c_str()); 209 258 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 217 268 TRACE("After deleting graphics objects"); 269 270 // Update cumulative data range 271 collectDataRanges(_cumulativeDataRange); 218 272 219 273 delete itr->second; 220 274 _dataSets.erase(itr); 221 _needsRedraw = true; 222 } 275 } while (doAll && ++itr != _dataSets.end()); 276 277 _needsRedraw = true; 223 278 } 224 279 … … 228 283 * \return A pointer to the DataSet, or NULL if not found 229 284 */ 230 DataSet *Renderer::getDataSet( DataSetIdid)285 DataSet *Renderer::getDataSet(const DataSetId& id) 231 286 { 232 287 DataSetHashmap::iterator itr = _dataSets.find(id); … … 241 296 * \brief (Re-)load the data for the specified DataSet key from a file 242 297 */ 243 bool Renderer::setDataFile( DataSetIdid, const char *filename)298 bool Renderer::setDataFile(const DataSetId& id, const char *filename) 244 299 { 245 300 DataSet *ds = getDataSet(id); 246 301 if (ds) { 247 302 bool ret = ds->setDataFile(filename); 248 PseudoColor *ps = getPseudoColor(id); 249 if (ps) { 250 ps->setDataSet(ds); 251 } 303 collectDataRanges(_cumulativeDataRange); 304 updateRanges(_useCumulativeRanges); 252 305 _needsRedraw = true; 253 306 return ret; … … 259 312 * \brief (Re-)load the data for the specified DataSet key from a memory buffer 260 313 */ 261 bool Renderer::setData( DataSetIdid, char *data, int nbytes)314 bool Renderer::setData(const DataSetId& id, char *data, int nbytes) 262 315 { 263 316 DataSet *ds = getDataSet(id); 264 317 if (ds) { 318 bool ret = ds->setData(data, nbytes); 319 collectDataRanges(_cumulativeDataRange); 320 updateRanges(_useCumulativeRanges); 265 321 _needsRedraw = true; 266 return ds->setData(data, nbytes);322 return ret; 267 323 } else 268 324 return false; … … 521 577 * \brief Add a color map for use in the Renderer 522 578 */ 523 void Renderer::addColorMap( ColorMapIdid, ColorMap *colorMap)579 void Renderer::addColorMap(const ColorMapId& id, ColorMap *colorMap) 524 580 { 525 581 if (colorMap != NULL) { … … 538 594 * \brief Return the ColorMap associated with the colormap key given 539 595 */ 540 ColorMap *Renderer::getColorMap( ColorMapIdid)596 ColorMap *Renderer::getColorMap(const ColorMapId& id) 541 597 { 542 598 ColorMapHashmap::iterator itr = _colorMaps.find(id); … … 554 610 * by any other objects 555 611 */ 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); 612 void 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()); 565 637 } 566 638 … … 568 640 * \brief Render a labelled legend image for the given colormap 569 641 * 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 */ 645 bool Renderer::renderColorMap(const ColorMapId& id, 646 const DataSetId& dataSetID, 647 const char *title, 573 648 int width, int height, 574 649 vtkUnsignedCharArray *imgData) 575 650 { 651 ColorMap *colorMap = getColorMap(id); 652 if (colorMap == NULL) 653 return false; 654 576 655 if (_legendRenderWindow == NULL) { 577 656 _legendRenderWindow = vtkSmartPointer<vtkRenderWindow>::New(); … … 593 672 _legendRenderer->AddActor(_scalarBarActor); 594 673 } 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 596 690 // Set viewport-relative width/height/pos 597 691 if (width > height) { … … 615 709 616 710 _legendRenderWindow->GetPixelData(0, 0, width-1, height-1, 1, imgData); 711 return true; 617 712 } 618 713 … … 620 715 * \brief Create a new PseudoColor rendering for the specified DataSet 621 716 */ 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()); 717 void 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()); 638 748 639 749 initCamera(); … … 644 754 * \brief Get the PseudoColor associated with the specified DataSet 645 755 */ 646 PseudoColor *Renderer::getPseudoColor( DataSetIdid)756 PseudoColor *Renderer::getPseudoColor(const DataSetId& id) 647 757 { 648 758 PseudoColorHashmap::iterator itr = _pseudoColors.find(id); … … 658 768 * \brief Associate an existing named color map with a DataSet 659 769 */ 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 } 770 void 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; 676 808 } 677 809 … … 681 813 * \return The associated lookup table or NULL if not found 682 814 */ 683 vtkLookupTable *Renderer::getPseudoColorColorMap( DataSetIdid)815 vtkLookupTable *Renderer::getPseudoColorColorMap(const DataSetId& id) 684 816 { 685 817 PseudoColor *pc = getPseudoColor(id); … … 691 823 692 824 /** 825 * \brief Set opacity of the PseudoColor for the given DataSet 826 */ 827 void 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 /** 693 853 * \brief Turn on/off rendering of the PseudoColor mapper for the given DataSet 694 854 */ 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 } 855 void 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; 702 878 } 703 879 … … 705 881 * \brief Set the visibility of polygon edges for the specified DataSet 706 882 */ 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 } 883 void 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; 714 906 } 715 907 … … 717 909 * \brief Set the RGB polygon edge color for the specified DataSet 718 910 */ 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 } 911 void 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; 726 934 } 727 935 … … 732 940 * this function may not have an effect. 733 941 */ 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 } 942 void 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; 741 965 } 742 966 … … 744 968 * \brief Turn mesh lighting on/off for the specified DataSet 745 969 */ 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 } 970 void 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; 753 993 } 754 994 … … 756 996 * \brief Create a new Contour2D and associate it with the named DataSet 757 997 */ 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()); 998 void 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()); 775 1030 776 1031 initCamera(); … … 781 1036 * \brief Get the Contour2D associated with a named DataSet 782 1037 */ 783 Contour2D *Renderer::getContour2D( DataSetIdid)1038 Contour2D *Renderer::getContour2D(const DataSetId& id) 784 1039 { 785 1040 Contour2DHashmap::iterator itr = _contours.find(id); … … 795 1050 * \brief Set the number of equally spaced contour isolines for the given DataSet 796 1051 */ 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 } 1052 void 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; 804 1074 } 805 1075 … … 807 1077 * \brief Set a list of isovalues for the given DataSet 808 1078 */ 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 } 1079 void 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 */ 1106 void 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; 816 1128 } 817 1129 … … 819 1131 * \brief Turn on/off rendering contour lines for the given DataSet 820 1132 */ 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 } 1133 void 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; 828 1155 } 829 1156 … … 831 1158 * \brief Set the RGB isoline color for the specified DataSet 832 1159 */ 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 } 1160 void 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; 840 1182 } 841 1183 … … 846 1188 * this function may not have an effect. 847 1189 */ 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 } 1190 void 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; 855 1212 } 856 1213 … … 858 1215 * \brief Turn contour lighting on/off for the specified DataSet 859 1216 */ 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 } 1217 void 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; 867 1238 } 868 1239 … … 870 1241 * \brief Create a new PolyData and associate it with the named DataSet 871 1242 */ 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()); 1243 void 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()); 889 1275 890 1276 if (_cameraMode == IMAGE) … … 897 1283 * \brief Get the PolyData associated with a named DataSet 898 1284 */ 899 PolyData *Renderer::getPolyData( DataSetIdid)1285 PolyData *Renderer::getPolyData(const DataSetId& id) 900 1286 { 901 1287 PolyDataHashmap::iterator itr = _polyDatas.find(id); … … 909 1295 910 1296 /** 1297 * \brief Set opacity of the PolyData for the given DataSet 1298 */ 1299 void 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 /** 911 1324 * \brief Turn on/off rendering of the PolyData mapper for the given DataSet 912 1325 */ 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 } 1326 void 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; 920 1348 } 921 1349 … … 923 1351 * \brief Set the RGB polygon face color for the specified DataSet 924 1352 */ 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 } 1353 void 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; 932 1374 } 933 1375 … … 935 1377 * \brief Set the visibility of polygon edges for the specified DataSet 936 1378 */ 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 } 1379 void 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; 944 1401 } 945 1402 … … 947 1404 * \brief Set the RGB polygon edge color for the specified DataSet 948 1405 */ 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 } 1406 void 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; 956 1428 } 957 1429 … … 962 1434 * this function may not have an effect. 963 1435 */ 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 } 1436 void 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; 971 1458 } 972 1459 … … 974 1461 * \brief Set wireframe rendering for the specified DataSet 975 1462 */ 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 } 1463 void 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; 983 1485 } 984 1486 … … 986 1488 * \brief Turn mesh lighting on/off for the specified DataSet 987 1489 */ 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 } 1490 void 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; 995 1512 } 996 1513 … … 1289 1806 } 1290 1807 } 1808 } 1809 1810 /** 1811 * \brief Update data ranges for color-mapping 1812 * 1813 * \param[in] useCumulative Use cumulative range of all DataSets 1814 */ 1815 void 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 */ 1839 void 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; 1291 1855 } 1292 1856 … … 1357 1921 * \brief Set the opacity of the specified DataSet's associated graphics objects 1358 1922 */ 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 } 1923 void Renderer::setOpacity(const DataSetId& id, double opacity) 1924 { 1925 setPseudoColorOpacity(id, opacity); 1926 setContourOpacity(id, opacity); 1927 setPolyDataOpacity(id, opacity); 1376 1928 } 1377 1929 … … 1379 1931 * \brief Turn on/off rendering of the specified DataSet's associated graphics objects 1380 1932 */ 1381 void Renderer::setVisibility( DataSetIdid, bool state)1933 void Renderer::setVisibility(const DataSetId& id, bool state) 1382 1934 { 1383 1935 setPseudoColorVisibility(id, state); … … 1402 1954 for (Contour2DHashmap::iterator itr = _contours.begin(); 1403 1955 itr != _contours.end(); ++itr) { 1956 itr->second->setClippingPlanes(_clippingPlanes); 1957 } 1958 for (PolyDataHashmap::iterator itr = _polyDatas.begin(); 1959 itr != _polyDatas.end(); ++itr) { 1404 1960 itr->second->setClippingPlanes(_clippingPlanes); 1405 1961 } … … 1413 1969 itr->second->setClippingPlanes(NULL); 1414 1970 } 1971 for (PolyDataHashmap::iterator itr = _polyDatas.begin(); 1972 itr != _polyDatas.end(); ++itr) { 1973 itr->second->setClippingPlanes(NULL); 1974 } 1415 1975 } 1416 1976 _renderWindow->Render(); … … 1447 2007 * Note: no interpolation is performed on data 1448 2008 */ 1449 double Renderer::getDataValueAtPixel( DataSetIdid, int x, int y)2009 double Renderer::getDataValueAtPixel(const DataSetId& id, int x, int y) 1450 2010 { 1451 2011 vtkSmartPointer<vtkCoordinate> coord = vtkSmartPointer<vtkCoordinate>::New(); … … 1469 2029 * Note: no interpolation is performed on data 1470 2030 */ 1471 double Renderer::getDataValue( DataSetIdid, double x, double y, double z)2031 double Renderer::getDataValue(const DataSetId& id, double x, double y, double z) 1472 2032 { 1473 2033 DataSet *ds = getDataSet(id); -
branches/blt4/packages/vizservers/vtkvis/RpVtkRenderer.h
r2120 r2170 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(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, 141 143 int width, int height, 142 144 vtkUnsignedCharArray *imgData); … … 144 146 // Color-mapped surfaces 145 147 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); 165 169 166 170 // Contour plots 167 171 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); 185 191 186 192 // Meshes 187 193 188 void addPolyData( DataSetIdid);194 void addPolyData(const DataSetId& id); 189 195 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); 207 215 208 216 private: … … 220 228 void collectBounds(double *bounds, bool onlyVisible); 221 229 230 void collectDataRanges(double *range); 231 232 void updateRanges(bool useCumulative); 233 222 234 void storeCameraOrientation(); 223 235 void restoreCameraOrientation(); … … 234 246 double _cameraUp[3]; 235 247 float _bgColor[3]; 248 bool _useCumulativeRanges; 249 double _cumulativeDataRange[2]; 236 250 237 251 ColorMapHashmap _colorMaps; -
branches/blt4/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp
r2120 r2170 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); … … 400 400 Tcl_Obj *const *objv) 401 401 { 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 } 404 408 return TCL_OK; 405 409 } … … 407 411 static Rappture::CmdSpec colorMapOps[] = { 408 412 {"add", 1, ColorMapAddOp, 5, 5, "colorMapName colormap alphamap"}, 409 {"delete", 1, ColorMapDeleteOp, 3, 3, "colorMapName"}413 {"delete", 1, ColorMapDeleteOp, 2, 3, "?colorMapName?"} 410 414 }; 411 415 static int nColorMapOps = NumCmdSpecs(colorMapOps); … … 429 433 Tcl_Obj *const *objv) 430 434 { 431 const char *name = Tcl_GetString(objv[4]);432 g_renderer->addContour2D(name);433 435 std::vector<double> contourList; 434 436 … … 448 450 } 449 451 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 } 451 460 return TCL_OK; 452 461 } … … 456 465 Tcl_Obj *const *objv) 457 466 { 458 const char *name = Tcl_GetString(objv[4]);459 g_renderer->addContour2D(name);460 467 int numContours; 461 468 if (Tcl_GetIntFromObj(interp, objv[3], &numContours) != TCL_OK) { 462 469 return TCL_ERROR; 463 470 } 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 } 465 479 return TCL_OK; 466 480 } 467 481 468 482 static 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?"} 471 485 }; 472 486 static int nContour2dAddOps = NumCmdSpecs(contour2dAddOps); … … 490 504 Tcl_Obj *const *objv) 491 505 { 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 } 494 512 return TCL_OK; 495 513 } … … 499 517 Tcl_Obj *const *objv) 500 518 { 501 const char *name = Tcl_GetString(objv[3]);502 519 bool state; 503 520 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 504 521 return TCL_ERROR; 505 522 } 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 } 507 529 return TCL_OK; 508 530 } … … 512 534 Tcl_Obj *const *objv) 513 535 { 514 const char *name = Tcl_GetString(objv[5]);515 536 float color[3]; 516 537 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK || … … 519 540 return TCL_ERROR; 520 541 } 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 } 522 548 return TCL_OK; 523 549 } … … 527 553 Tcl_Obj *const *objv) 528 554 { 529 const char *name = Tcl_GetString(objv[3]);530 555 float width; 531 556 if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) { 532 557 return TCL_ERROR; 533 558 } 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 568 static int 569 Contour2DOpacityOp(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 } 535 582 return TCL_OK; 536 583 } … … 540 587 Tcl_Obj *const *objv) 541 588 { 542 const char *name = Tcl_GetString(objv[3]);543 589 bool state; 544 590 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 545 591 return TCL_ERROR; 546 592 } 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 } 548 599 return TCL_OK; 549 600 } 550 601 551 602 static 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?"} 558 610 }; 559 611 static int nContour2dOps = NumCmdSpecs(contour2dOps); … … 627 679 Tcl_Obj *const *objv) 628 680 { 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 } 632 688 return TCL_OK; 633 689 } … … 712 768 Tcl_Obj *const *objv) 713 769 { 714 const char *name = Tcl_GetString(objv[3]);715 770 double opacity; 716 771 if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) { 717 772 return TCL_ERROR; 718 773 } 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 } 720 780 return TCL_OK; 721 781 } … … 725 785 Tcl_Obj *const *objv) 726 786 { 727 const char *name = Tcl_GetString(objv[3]);728 787 bool state; 729 788 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 730 789 return TCL_ERROR; 731 790 } 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 } 733 797 return TCL_OK; 734 798 } … … 736 800 static Rappture::CmdSpec dataSetOps[] = { 737 801 {"add", 1, DataSetAddOp, 6, 6, "name data follows nBytes"}, 738 {"delete", 1, DataSetDeleteOp, 3, 3, "name"},802 {"delete", 1, DataSetDeleteOp, 2, 3, "?name?"}, 739 803 {"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?"} 742 806 }; 743 807 static int nDataSetOps = NumCmdSpecs(dataSetOps); … … 763 827 if (objc < 4) { 764 828 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); 766 830 return TCL_ERROR; 767 831 } … … 778 842 vtkSmartPointer<vtkUnsignedCharArray>::New(); 779 843 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 } 781 858 782 859 #ifdef DEBUG … … 795 872 Tcl_Obj *const *objv) 796 873 { 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 } 799 880 return TCL_OK; 800 881 } … … 805 886 { 806 887 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 } 809 894 return TCL_OK; 810 895 } … … 814 899 Tcl_Obj *const *objv) 815 900 { 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 910 static int 911 PseudoColorEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc, 912 Tcl_Obj *const *objv) 913 { 826 914 bool state; 827 915 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 828 916 return TCL_ERROR; 829 917 } 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 927 static int 928 PseudoColorLightingOp(ClientData clientData, Tcl_Interp *interp, int objc, 929 Tcl_Obj *const *objv) 930 { 839 931 bool state; 840 932 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 841 933 return TCL_ERROR; 842 934 } 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 } 857 941 return TCL_OK; 858 942 } … … 862 946 Tcl_Obj *const *objv) 863 947 { 864 const char *name = Tcl_GetString(objv[5]);865 948 float color[3]; 866 949 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK || … … 869 952 return TCL_ERROR; 870 953 } 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 } 872 960 return TCL_OK; 873 961 } … … 877 965 Tcl_Obj *const *objv) 878 966 { 879 const char *name = Tcl_GetString(objv[3]);880 967 float width; 881 968 if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) { 882 969 return TCL_ERROR; 883 970 } 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 980 static int 981 PseudoColorOpacityOp(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 997 static int 998 PseudoColorVisibleOp(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 } 885 1011 return TCL_OK; 886 1012 } 887 1013 888 1014 static 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?"} 897 1024 }; 898 1025 static int nPseudoColorOps = NumCmdSpecs(pseudoColorOps); … … 916 1043 Tcl_Obj *const *objv) 917 1044 { 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 } 920 1051 return TCL_OK; 921 1052 } … … 925 1056 Tcl_Obj *const *objv) 926 1057 { 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 } 929 1064 return TCL_OK; 930 1065 } … … 934 1069 Tcl_Obj *const *objv) 935 1070 { 936 const char *name = Tcl_GetString(objv[5]);937 1071 float color[3]; 938 1072 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK || … … 941 1075 return TCL_ERROR; 942 1076 } 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 } 944 1083 return TCL_OK; 945 1084 } … … 949 1088 Tcl_Obj *const *objv) 950 1089 { 951 const char *name = Tcl_GetString(objv[3]);952 1090 bool state; 953 1091 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 954 1092 return TCL_ERROR; 955 1093 } 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 } 957 1100 return TCL_OK; 958 1101 } … … 962 1105 Tcl_Obj *const *objv) 963 1106 { 964 const char *name = Tcl_GetString(objv[3]);965 1107 bool state; 966 1108 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 967 1109 return TCL_ERROR; 968 1110 } 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 } 970 1117 return TCL_OK; 971 1118 } … … 975 1122 Tcl_Obj *const *objv) 976 1123 { 977 const char *name = Tcl_GetString(objv[5]);978 1124 float color[3]; 979 1125 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK || … … 982 1128 return TCL_ERROR; 983 1129 } 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 } 985 1136 return TCL_OK; 986 1137 } … … 990 1141 Tcl_Obj *const *objv) 991 1142 { 992 const char *name = Tcl_GetString(objv[3]);993 1143 float width; 994 1144 if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) { 995 1145 return TCL_ERROR; 996 1146 } 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 1156 static int 1157 PolyDataOpacityOp(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 } 998 1170 return TCL_OK; 999 1171 } … … 1003 1175 Tcl_Obj *const *objv) 1004 1176 { 1005 const char *name = Tcl_GetString(objv[3]);1006 1177 bool state; 1007 1178 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 1008 1179 return TCL_ERROR; 1009 1180 } 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 } 1011 1187 return TCL_OK; 1012 1188 } … … 1016 1192 Tcl_Obj *const *objv) 1017 1193 { 1018 const char *name = Tcl_GetString(objv[3]);1019 1194 bool state; 1020 1195 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 1021 1196 return TCL_ERROR; 1022 1197 } 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 } 1024 1204 return TCL_OK; 1025 1205 } 1026 1206 1027 1207 static 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?"} 1037 1218 }; 1038 1219 static int nPolyDataOps = NumCmdSpecs(polyDataOps); -
branches/blt4/packages/vizservers/vtkvis/protocol.txt
r2120 r2170 31 31 Specify zoom ratio 32 32 33 colormap add <colorMapName> <colorMap> <opacityMap> 34 colorMap = Tcl list of {value r g b} control points 35 opacityMap = Tcl list of {value alpha} control points 36 colormap delete <?colorMapName?> 37 38 legend <colormapName> <legendTitle> <width> <height> <?datasetName?> 39 Causes legend to be rendered and written back with labels and title 40 33 41 dataset add <datasetName> data follows <nbytes> 34 dataset delete < datasetName>42 dataset delete <?datasetName?> 35 43 dataset getvalue world <x> <y> <z> <datasetName> 36 44 dataset getvalue pixel <x> <y> <datasetName> 37 45 Use pixel for image camera mode 38 dataset opacity <val> < datasetName>39 dataset visible <bool> < datasetName>46 dataset opacity <val> <?datasetName?> 47 dataset visible <bool> <?datasetName?> 40 48 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> 49 pseudocolor add <?datasetName?> 50 pseudocolor colormap <colormapName> <?datasetName?> 51 pseudocolor delete <?datasetName?> 52 pseudocolor edges <bool> <?datasetName?> 53 pseudocolor lighting <bool> <?datasetName?> 54 pseudocolor linecolor <r> <g> <b> <?datasetName?> 55 pseudocolor linewidth <val> <?datasetName?> 56 pseudocolor opacity <val> <?datasetName?> 57 pseudocolor visible <bool> <?datasetName?> 45 58 46 legend <colormapName> <legendTitle> <width> <height> 47 Causes legend to be rendered and written back with labels and title 59 contour2d add numcontours <n> <?datasetName?> 60 contour2d add contourlist <list> <?datasetName?> 61 list = {isoval1 isoval2 isoval3...} 62 contour2d delete <?datasetName?> 63 contour2d lighting <bool> <?datasetName?> 64 contour2d linecolor <r> <g> <b> <?datasetName?> 65 contour2d linewidth <val> <?datasetName?> 66 contour2d opacity <val> <?datasetName?> 67 contour2d visible <bool> <?datasetName?> 48 68 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> 69 polydata add <?datasetName?> 70 polydata color <r> <g> <b> <?datasetName?> 71 polydata delete <?datasetName?> 72 polydata edges <bool> <?datasetName?> 73 polydata lighting <bool> <?datasetName?> 74 polydata linecolor <r> <g> <b> <?datasetName?> 75 polydata linewidth <val> <?datasetName?> 76 polydata opacity <val> <?datasetName?> 77 polydata visible <bool> <?datasetName?> 78 polydata wireframe <bool> <?datasetName?> 73 79 74 80 ================================================================================
Note: See TracChangeset
for help on using the changeset viewer.