Changeset 3153
- Timestamp:
- Aug 24, 2012, 2:14:24 PM (12 years ago)
- Location:
- trunk/packages/vizservers/vtkvis
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp
r3148 r3153 897 897 void Renderer::updateColorMap(ColorMap *cmap) 898 898 { 899 for (Contour2DHashmap::iterator itr = _contour2Ds.begin(); 900 itr != _contour2Ds.end(); ++itr) { 901 if (itr->second->getColorMap() == cmap) { 902 itr->second->updateColorMap(); 903 _needsRedraw = true; 904 } 905 } 899 906 for (Contour3DHashmap::iterator itr = _contour3Ds.begin(); 900 907 itr != _contour3Ds.end(); ++itr) { … … 974 981 bool Renderer::colorMapUsed(ColorMap *cmap) 975 982 { 983 for (Contour2DHashmap::iterator itr = _contour2Ds.begin(); 984 itr != _contour2Ds.end(); ++itr) { 985 if (itr->second->getColorMap() == cmap) 986 return true; 987 } 976 988 for (Contour3DHashmap::iterator itr = _contour3Ds.begin(); 977 989 itr != _contour3Ds.end(); ++itr) { -
trunk/packages/vizservers/vtkvis/RpVtkRenderer.h
r3149 r3153 369 369 void setContour2DContourList(const DataSetId& id, const std::vector<double>& contours); 370 370 371 void setContour2DColorMode(const DataSetId& id, 372 Contour2D::ColorMode mode, 373 const char *name, double range[2] = NULL); 374 375 void setContour2DColorMode(const DataSetId& id, 376 Contour2D::ColorMode mode, 377 DataSet::DataAttributeType type, 378 const char *name, double range[2] = NULL); 379 371 380 // 3D Contour (isosurface) plots 372 381 -
trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp
r3149 r3153 1064 1064 1065 1065 static int 1066 Contour2DColorMapOp(ClientData clientData, Tcl_Interp *interp, int objc, 1067 Tcl_Obj *const *objv) 1068 { 1069 const char *colorMapName = Tcl_GetString(objv[2]); 1070 if (objc == 4) { 1071 const char *dataSetName = Tcl_GetString(objv[3]); 1072 g_renderer->setGraphicsObjectColorMap<Contour2D>(dataSetName, colorMapName); 1073 } else { 1074 g_renderer->setGraphicsObjectColorMap<Contour2D>("all", colorMapName); 1075 } 1076 return TCL_OK; 1077 } 1078 1079 static int 1080 Contour2DColorModeOp(ClientData clientData, Tcl_Interp *interp, int objc, 1081 Tcl_Obj *const *objv) 1082 { 1083 Contour2D::ColorMode mode; 1084 const char *str = Tcl_GetString(objv[2]); 1085 if (str[0] == 'c' && strcmp(str, "ccolor") == 0) { 1086 mode = Contour2D::COLOR_CONSTANT; 1087 } else if (str[0] == 's' && strcmp(str, "scalar") == 0) { 1088 mode = Contour2D::COLOR_BY_SCALAR; 1089 } else if (str[0] == 'v' && strcmp(str, "vmag") == 0) { 1090 mode = Contour2D::COLOR_BY_VECTOR_MAGNITUDE; 1091 } else if (str[0] == 'v' && strcmp(str, "vx") == 0) { 1092 mode = Contour2D::COLOR_BY_VECTOR_X; 1093 } else if (str[0] == 'v' && strcmp(str, "vy") == 0) { 1094 mode = Contour2D::COLOR_BY_VECTOR_Y; 1095 } else if (str[0] == 'v' && strcmp(str, "vz") == 0) { 1096 mode = Contour2D::COLOR_BY_VECTOR_Z; 1097 } else { 1098 Tcl_AppendResult(interp, "bad color mode option \"", str, 1099 "\": should be one of: 'scalar', 'vmag', 'vx', 'vy', 'vz', 'ccolor'", (char*)NULL); 1100 return TCL_ERROR; 1101 } 1102 const char *fieldName = Tcl_GetString(objv[3]); 1103 if (mode == Contour2D::COLOR_CONSTANT) { 1104 fieldName = NULL; 1105 } 1106 if (objc == 5) { 1107 const char *name = Tcl_GetString(objv[4]); 1108 g_renderer->setContour2DColorMode(name, mode, fieldName); 1109 } else { 1110 g_renderer->setContour2DColorMode("all", mode, fieldName); 1111 } 1112 return TCL_OK; 1113 } 1114 1115 static int 1066 1116 Contour2DLightingOp(ClientData clientData, Tcl_Interp *interp, int objc, 1067 1117 Tcl_Obj *const *objv) … … 1210 1260 static Rappture::CmdSpec contour2dOps[] = { 1211 1261 {"add", 1, Contour2DAddOp, 4, 5, "oper value ?dataSetName?"}, 1212 {"color", 1, Contour2DLineColorOp, 5, 6, "r g b ?dataSetName?"}, 1262 {"ccolor", 2, Contour2DLineColorOp, 5, 6, "r g b ?dataSetName?"}, 1263 {"colormap", 7, Contour2DColorMapOp, 3, 4, "colorMapName ?dataSetName?"}, 1264 {"colormode", 7, Contour2DColorModeOp, 4, 5, "mode fieldName ?dataSetName?"}, 1213 1265 {"delete", 1, Contour2DDeleteOp, 2, 3, "?dataSetName?"}, 1214 1266 {"lighting", 3, Contour2DLightingOp, 3, 4, "bool ?dataSetName?"}, -
trunk/packages/vizservers/vtkvis/RpVtkRendererGraphicsObjs.cpp
r3150 r3153 361 361 } 362 362 363 364 /** 365 * \brief Set the color mode for the specified DataSet 366 */ 367 void Renderer::setContour2DColorMode(const DataSetId& id, 368 Contour2D::ColorMode mode, 369 DataSet::DataAttributeType type, 370 const char *name, double range[2]) 371 { 372 Contour2DHashmap::iterator itr; 373 374 bool doAll = false; 375 376 if (id.compare("all") == 0) { 377 itr = _contour2Ds.begin(); 378 doAll = true; 379 } else { 380 itr = _contour2Ds.find(id); 381 } 382 if (itr == _contour2Ds.end()) { 383 ERROR("Contour2D not found: %s", id.c_str()); 384 return; 385 } 386 387 do { 388 itr->second->setColorMode(mode, type, name, range); 389 } while (doAll && ++itr != _contour2Ds.end()); 390 391 _needsRedraw = true; 392 } 393 394 /** 395 * \brief Set the color mode for the specified DataSet 396 */ 397 void Renderer::setContour2DColorMode(const DataSetId& id, 398 Contour2D::ColorMode mode, 399 const char *name, double range[2]) 400 { 401 Contour2DHashmap::iterator itr; 402 403 bool doAll = false; 404 405 if (id.compare("all") == 0) { 406 itr = _contour2Ds.begin(); 407 doAll = true; 408 } else { 409 itr = _contour2Ds.find(id); 410 } 411 if (itr == _contour2Ds.end()) { 412 ERROR("Contour2D not found: %s", id.c_str()); 413 return; 414 } 415 416 do { 417 itr->second->setColorMode(mode, name, range); 418 } while (doAll && ++itr != _contour2Ds.end()); 419 420 _needsRedraw = true; 421 } 422 363 423 /** 364 424 * \brief Create a new Contour3D and associate it with the named DataSet … … 1465 1525 } 1466 1526 1467 1468 1527 /** 1469 1528 * \brief Set the color mode for the specified DataSet -
trunk/packages/vizservers/vtkvis/protocol.txt
r3149 r3153 149 149 contour2d add contourlist <list> <?datasetName?> 150 150 list = {isoval1 isoval2 isoval3...} 151 contour2d c olor <r> <g> <b> <?datasetName?>151 contour2d ccolor <r> <g> <b> <?datasetName?> 152 152 synonym for linecolor 153 contour2d colormap <colormapName> <?datasetName?> 154 contour2d colormode <scalar|vmag|vx|vy|vz|ccolor> <fieldName> <?datasetName?> 155 Set the field used to color the object. 'ccolor' means to use 156 the constant color defined by the ccolor subcommand. 'scalar' uses 157 the active scalar field. 'vmag' uses the magnitude of the current 158 vector field, and 'vx','vy','vz' use the corresponding component of 159 the active vector field. 153 160 contour2d delete <?datasetName?> 154 161 contour2d lighting <bool> <?datasetName?> … … 342 349 343 350 pseudocolor add <?datasetName?> 344 pseudocolor ccolor r g b<?datasetName?>351 pseudocolor ccolor <r> <g> <b> <?datasetName?> 345 352 pseudocolor colormap <colormapName> <?datasetName?> 346 353 pseudocolor colormode <scalar|vmag|vx|vy|vz|ccolor> <fieldName> <?datasetName?>
Note: See TracChangeset
for help on using the changeset viewer.