Changeset 3148 for trunk/packages/vizservers/vtkvis
- Timestamp:
- Aug 23, 2012 2:35:43 PM (12 years ago)
- Location:
- trunk/packages/vizservers/vtkvis
- Files:
-
- 6 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/Makefile.in
r3125 r3148 83 83 PPMWriter.cpp \ 84 84 ReadBuffer.cpp \ 85 RpBox.cpp \ 85 86 RpContour2D.cpp \ 86 87 RpContour3D.cpp \ … … 92 93 RpPolyData.cpp \ 93 94 RpPseudoColor.cpp \ 95 RpShape.cpp \ 96 RpSphere.cpp \ 94 97 RpStreamlines.cpp \ 95 98 RpVolume.cpp \ … … 150 153 ReadBuffer.o: ReadBuffer.h Trace.h 151 154 ResponseQueue.o: ResponseQueue.h Trace.h 155 RpBox.o: RpBox.h RpShape.h RpVtkGraphicsObject.h RpVtkDataSet.h RpVtkRenderer.h Trace.h 152 156 RpContour2D.o: RpContour2D.h RpVtkGraphicsObject.h RpVtkDataSet.h RpVtkRenderer.h Trace.h 153 157 RpContour3D.o: RpContour3D.h RpVtkGraphicsObject.h RpVtkDataSet.h RpVtkRenderer.h ColorMap.h Trace.h … … 159 163 RpPolyData.o: RpPolyData.h RpVtkGraphicsObject.h RpVtkDataSet.h RpVtkRenderer.h Trace.h 160 164 RpPseudoColor.o: RpPseudoColor.h RpVtkGraphicsObject.h RpVtkDataSet.h RpVtkRenderer.h ColorMap.h Trace.h 165 RpShape.o: RpShape.h RpVtkGraphicsObject.h RpVtkDataSet.h RpVtkRenderer.h Trace.h 166 RpSphere.o: RpSphere.h RpShape.h RpVtkGraphicsObject.h RpVtkDataSet.h RpVtkRenderer.h Trace.h 161 167 RpStreamlines.o: RpStreamlines.h RpVtkGraphicsObject.h RpVtkDataSet.h RpVtkRenderer.h ColorMap.h Trace.h 162 168 RpVolume.o: RpVolume.h RpVtkGraphicsObject.h RpVtkDataSet.h RpVtkRenderer.h ColorMap.h Trace.h 163 169 RpVtkDataSet.o: RpVtkDataSet.h Trace.h 164 RpVtkGraphicsObject.o: RpVtkGraphicsObject.h RpVtkRenderer.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpCutplane.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.hColorMap.h Trace.h165 RpVtkRenderer.o: RpVtkRenderer.h RpMath.h vtkRpCubeAxesActor2D.h RpVtkDataSet.h Rp Contour2D.h RpContour3D.h RpCutplane.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h166 RpVtkRendererCmd.o: RpVtkRenderer.h RpVtkRendererGraphicsObjs.h vtkRpCubeAxesActor2D.h RpVtkDataSet.h Rp Contour2D.h RpContour3D.h RpCutplane.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h ReadBuffer.h ResponseQueue.h Trace.h CmdProc.h PPMWriter.h TGAWriter.h170 RpVtkGraphicsObject.o: RpVtkGraphicsObject.h RpVtkRenderer.h RpVtkDataSet.h ColorMap.h Trace.h 171 RpVtkRenderer.o: RpVtkRenderer.h RpMath.h vtkRpCubeAxesActor2D.h RpVtkDataSet.h RpBox.h RpContour2D.h RpContour3D.h RpCutplane.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpSphere.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h 172 RpVtkRendererCmd.o: RpVtkRenderer.h RpVtkRendererGraphicsObjs.h vtkRpCubeAxesActor2D.h RpVtkDataSet.h RpBox.h RpContour2D.h RpContour3D.h RpCutplane.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpSphere.h RpStreamlines.h RpVolume.h ColorMap.h ReadBuffer.h ResponseQueue.h Trace.h CmdProc.h PPMWriter.h TGAWriter.h 167 173 RpVtkRendererGraphicsObjs.o: RpVtkRenderer.h RpVtkRendererGraphicsObjs.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpCutplane.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h 168 174 RpVtkRenderServer.o: RpVtkRenderServer.h RpVtkRendererCmd.h RpVtkRenderer.h vtkRpAxisActor.h vtkRpCubeAxesActor.h vtkRpAxisActor2D.h vtkRpCubeAxesActor2D.h ReadBuffer.h ResponseQueue.h Trace.h PPMWriter.h TGAWriter.h -
trunk/packages/vizservers/vtkvis/RpGlyphs.cpp
r3106 r3148 181 181 #endif 182 182 183 //setQuality(0.8); 184 } 185 186 void Glyphs::setQuality(double quality) 187 { 188 switch (_glyphShape) { 189 case ARROW: { 190 vtkSmartPointer<vtkArrowSource> arrow = vtkArrowSource::SafeDownCast(_glyphSource); 191 int res = (int)(quality * 25); 192 if (res < 5) res = 5; 193 arrow->SetTipResolution(res); 194 arrow->SetShaftResolution(res); 195 } 196 break; 197 case CONE: { 198 vtkSmartPointer<vtkConeSource> cone = vtkConeSource::SafeDownCast(_glyphSource); 199 int res = (int)(quality * 25); 200 if (res < 5) res = 5; 201 cone->SetResolution(res); 202 } 203 break; 204 case SPHERE: { 205 vtkSmartPointer<vtkSphereSource> sphere = vtkSphereSource::SafeDownCast(_glyphSource); 206 int res = (int)(quality * 50); 207 if (res < 5) res = 5; 208 sphere->SetThetaResolution(res); 209 sphere->SetPhiResolution(res); 210 } 211 break; 212 case CYLINDER: { 213 assert (vtkTransformPolyDataFilter::SafeDownCast(_glyphSource) != NULL); 214 assert (vtkTransformPolyDataFilter::SafeDownCast(_glyphSource)->GetInput() != NULL); 215 TRACE("gsource input: %s", vtkTransformPolyDataFilter::SafeDownCast(_glyphSource)->GetInput()->GetClassName()); 216 vtkSmartPointer<vtkCylinderSource> csource = vtkCylinderSource::SafeDownCast(vtkTransformPolyDataFilter::SafeDownCast(_glyphSource)->GetInput()->GetProducerPort()); 217 int res = (int)(quality * 25); 218 if (res < 5) res = 5; 219 csource->SetResolution(res); 220 } 221 break; 222 default: 223 break; 224 } 183 225 } 184 226 -
trunk/packages/vizservers/vtkvis/RpGlyphs.h
r3095 r3148 77 77 virtual void setClippingPlanes(vtkPlaneCollection *planes); 78 78 79 void setQuality(double quality); 80 79 81 void setOrient(bool state); 80 82 -
trunk/packages/vizservers/vtkvis/RpPolyData.cpp
r2641 r3148 27 27 VtkGraphicsObject() 28 28 { 29 _color[0] = 0.0f;30 _color[1] = 0.0f;31 _color[2] = 1.0f;32 29 } 33 30 -
trunk/packages/vizservers/vtkvis/RpVtkGraphicsObject.h
r3131 r3148 70 70 */ 71 71 virtual const char *getClassName() const = 0; 72 73 /**74 * \brief Specify input DataSet75 *76 * Default implementation calls update()77 *78 * \param[in] dataSet DataSet to use in rendering79 */80 virtual void setDataSet(DataSet *dataSet)81 {82 if (_dataSet != dataSet) {83 _dataSet = dataSet;84 85 update();86 }87 }88 72 89 73 /** -
trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp
r3138 r3148 141 141 { 142 142 TRACE("Enter"); 143 TRACE("Deleting Boxes"); 144 for (BoxHashmap::iterator itr = _boxes.begin(); 145 itr != _boxes.end(); ++itr) { 146 delete itr->second; 147 } 148 _boxes.clear(); 143 149 TRACE("Deleting Contour2Ds"); 144 150 for (Contour2DHashmap::iterator itr = _contour2Ds.begin(); … … 195 201 } 196 202 _pseudoColors.clear(); 203 TRACE("Deleting Spheres"); 204 for (SphereHashmap::iterator itr = _spheres.begin(); 205 itr != _spheres.end(); ++itr) { 206 delete itr->second; 207 } 208 _spheres.clear(); 197 209 TRACE("Deleting Streamlines"); 198 210 for (StreamlinesHashmap::iterator itr = _streamlines.begin(); … … 553 565 554 566 _cubeAxesActor2D->ScalingOff(); 555 //_cubeAxesActor2D->SetShowActualBounds(0);567 _cubeAxesActor2D->SetShowActualBounds(1); 556 568 _cubeAxesActor2D->SetFontFactor(1.25); 557 569 // Use "nice" range and number of ticks/labels … … 2024 2036 double offsetX = pxOffsetX * pxToWorld; 2025 2037 double offsetY = pxOffsetY * pxToWorld; 2038 double plotWidthWorld = imgWidthPx * pxToWorld; 2039 double plotHeightWorld = imgHeightPx * pxToWorld; 2026 2040 2027 2041 TRACE("Window: %d %d", _windowWidth, _windowHeight); … … 2058 2072 _cameraClipPlanes[1]->SetNormal(1, 0, 0); 2059 2073 // top 2060 _cameraClipPlanes[2]->SetOrigin(0, _imgWorldOrigin[1] + _imgWorldDims[1], 0);2074 _cameraClipPlanes[2]->SetOrigin(0, _imgWorldOrigin[1] + plotHeightWorld, 0); 2061 2075 _cameraClipPlanes[2]->SetNormal(0, -1, 0); 2062 2076 // right 2063 _cameraClipPlanes[3]->SetOrigin(_imgWorldOrigin[0] + _imgWorldDims[0], 0, 0);2077 _cameraClipPlanes[3]->SetOrigin(_imgWorldOrigin[0] + plotWidthWorld, 0, 0); 2064 2078 _cameraClipPlanes[3]->SetNormal(-1, 0, 0); 2065 _cubeAxesActor2D->SetBounds(_imgWorldOrigin[0], _imgWorldOrigin[0] + _imgWorldDims[0],2066 _imgWorldOrigin[1], _imgWorldOrigin[1] + _imgWorldDims[1],2079 _cubeAxesActor2D->SetBounds(_imgWorldOrigin[0], _imgWorldOrigin[0] + plotWidthWorld, 2080 _imgWorldOrigin[1], _imgWorldOrigin[1] + plotHeightWorld, 2067 2081 _imgCameraOffset, _imgCameraOffset); 2068 2082 _cubeAxesActor2D->XAxisVisibilityOn(); … … 2081 2095 _cameraClipPlanes[1]->SetNormal(0, 0, 1); 2082 2096 // top 2083 _cameraClipPlanes[2]->SetOrigin(0, _imgWorldOrigin[1] + _imgWorldDims[1], 0);2097 _cameraClipPlanes[2]->SetOrigin(0, _imgWorldOrigin[1] + plotHeightWorld, 0); 2084 2098 _cameraClipPlanes[2]->SetNormal(0, -1, 0); 2085 2099 // right 2086 _cameraClipPlanes[3]->SetOrigin(0, 0, _imgWorldOrigin[0] + _imgWorldDims[0]);2100 _cameraClipPlanes[3]->SetOrigin(0, 0, _imgWorldOrigin[0] + plotWidthWorld); 2087 2101 _cameraClipPlanes[3]->SetNormal(0, 0, -1); 2088 2102 _cubeAxesActor2D->SetBounds(_imgCameraOffset, _imgCameraOffset, 2089 _imgWorldOrigin[1], _imgWorldOrigin[1] + _imgWorldDims[1],2090 _imgWorldOrigin[0], _imgWorldOrigin[0] + _imgWorldDims[0]);2103 _imgWorldOrigin[1], _imgWorldOrigin[1] + plotHeightWorld, 2104 _imgWorldOrigin[0], _imgWorldOrigin[0] + plotWidthWorld); 2091 2105 _cubeAxesActor2D->XAxisVisibilityOff(); 2092 2106 _cubeAxesActor2D->YAxisVisibilityOn(); … … 2104 2118 _cameraClipPlanes[1]->SetNormal(1, 0, 0); 2105 2119 // top 2106 _cameraClipPlanes[2]->SetOrigin(0, 0, _imgWorldOrigin[1] + _imgWorldDims[1]);2120 _cameraClipPlanes[2]->SetOrigin(0, 0, _imgWorldOrigin[1] + plotHeightWorld); 2107 2121 _cameraClipPlanes[2]->SetNormal(0, 0, -1); 2108 2122 // right 2109 _cameraClipPlanes[3]->SetOrigin(_imgWorldOrigin[0] + _imgWorldDims[0], 0, 0);2123 _cameraClipPlanes[3]->SetOrigin(_imgWorldOrigin[0] + plotWidthWorld, 0, 0); 2110 2124 _cameraClipPlanes[3]->SetNormal(-1, 0, 0); 2111 _cubeAxesActor2D->SetBounds(_imgWorldOrigin[0], _imgWorldOrigin[0] + _imgWorldDims[0],2125 _cubeAxesActor2D->SetBounds(_imgWorldOrigin[0], _imgWorldOrigin[0] + plotWidthWorld, 2112 2126 _imgCameraOffset, _imgCameraOffset, 2113 _imgWorldOrigin[1], _imgWorldOrigin[1] + _imgWorldDims[1]);2127 _imgWorldOrigin[1], _imgWorldOrigin[1] + plotHeightWorld); 2114 2128 _cubeAxesActor2D->XAxisVisibilityOn(); 2115 2129 _cubeAxesActor2D->YAxisVisibilityOff(); … … 2294 2308 mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds()); 2295 2309 } 2310 for (BoxHashmap::iterator itr = _boxes.begin(); 2311 itr != _boxes.end(); ++itr) { 2312 if ((!onlyVisible || itr->second->getVisibility()) && 2313 itr->second->getProp() != NULL) 2314 mergeBounds(bounds, bounds, itr->second->getBounds()); 2315 } 2296 2316 for (Contour2DHashmap::iterator itr = _contour2Ds.begin(); 2297 2317 itr != _contour2Ds.end(); ++itr) { … … 2344 2364 for (PseudoColorHashmap::iterator itr = _pseudoColors.begin(); 2345 2365 itr != _pseudoColors.end(); ++itr) { 2366 if ((!onlyVisible || itr->second->getVisibility()) && 2367 itr->second->getProp() != NULL) 2368 mergeBounds(bounds, bounds, itr->second->getBounds()); 2369 } 2370 for (SphereHashmap::iterator itr = _spheres.begin(); 2371 itr != _spheres.end(); ++itr) { 2346 2372 if ((!onlyVisible || itr->second->getVisibility()) && 2347 2373 itr->second->getProp() != NULL) … … 2419 2445 mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds()); 2420 2446 } 2447 for (BoxHashmap::iterator itr = _boxes.begin(); 2448 itr != _boxes.end(); ++itr) { 2449 if ((!onlyVisible || itr->second->getVisibility()) && 2450 itr->second->getProp() != NULL) 2451 mergeBounds(bounds, bounds, itr->second->getUnscaledBounds()); 2452 } 2421 2453 for (Contour2DHashmap::iterator itr = _contour2Ds.begin(); 2422 2454 itr != _contour2Ds.end(); ++itr) { … … 2469 2501 for (PseudoColorHashmap::iterator itr = _pseudoColors.begin(); 2470 2502 itr != _pseudoColors.end(); ++itr) { 2503 if ((!onlyVisible || itr->second->getVisibility()) && 2504 itr->second->getProp() != NULL) 2505 mergeBounds(bounds, bounds, itr->second->getUnscaledBounds()); 2506 } 2507 for (SphereHashmap::iterator itr = _spheres.begin(); 2508 itr != _spheres.end(); ++itr) { 2471 2509 if ((!onlyVisible || itr->second->getVisibility()) && 2472 2510 itr->second->getProp() != NULL) … … 3325 3363 * Mappers already using the PlaneCollection 3326 3364 */ 3365 for (BoxHashmap::iterator itr = _boxes.begin(); 3366 itr != _boxes.end(); ++itr) { 3367 itr->second->setClippingPlanes(_activeClipPlanes); 3368 } 3327 3369 for (Contour2DHashmap::iterator itr = _contour2Ds.begin(); 3328 3370 itr != _contour2Ds.end(); ++itr) { … … 3359 3401 for (PseudoColorHashmap::iterator itr = _pseudoColors.begin(); 3360 3402 itr != _pseudoColors.end(); ++itr) { 3403 itr->second->setClippingPlanes(_activeClipPlanes); 3404 } 3405 for (SphereHashmap::iterator itr = _spheres.begin(); 3406 itr != _spheres.end(); ++itr) { 3361 3407 itr->second->setClippingPlanes(_activeClipPlanes); 3362 3408 } -
trunk/packages/vizservers/vtkvis/RpVtkRenderer.h
r3145 r3148 30 30 #include "RpTypes.h" 31 31 #include "RpVtkDataSet.h" 32 #include "RpBox.h" 32 33 #include "RpContour2D.h" 33 34 #include "RpContour3D.h" … … 39 40 #include "RpPolyData.h" 40 41 #include "RpPseudoColor.h" 42 #include "RpSphere.h" 41 43 #include "RpStreamlines.h" 42 44 #include "RpVolume.h" … … 541 543 typedef std::tr1::unordered_map<FieldId, double *> FieldRangeHashmap; 542 544 typedef std::tr1::unordered_map<ColorMapId, ColorMap *> ColorMapHashmap; 545 typedef std::tr1::unordered_map<DataSetId, Box *> BoxHashmap; 543 546 typedef std::tr1::unordered_map<DataSetId, Contour2D *> Contour2DHashmap; 544 547 typedef std::tr1::unordered_map<DataSetId, Contour3D *> Contour3DHashmap; … … 550 553 typedef std::tr1::unordered_map<DataSetId, PolyData *> PolyDataHashmap; 551 554 typedef std::tr1::unordered_map<DataSetId, PseudoColor *> PseudoColorHashmap; 555 typedef std::tr1::unordered_map<DataSetId, Sphere *> SphereHashmap; 552 556 typedef std::tr1::unordered_map<DataSetId, Streamlines *> StreamlinesHashmap; 553 557 typedef std::tr1::unordered_map<DataSetId, Volume *> VolumeHashmap; … … 620 624 ColorMapHashmap _colorMaps; 621 625 DataSetHashmap _dataSets; 626 BoxHashmap _boxes; 622 627 Contour2DHashmap _contour2Ds; 623 628 Contour3DHashmap _contour3Ds; … … 629 634 PolyDataHashmap _polyDatas; 630 635 PseudoColorHashmap _pseudoColors; 636 SphereHashmap _spheres; 631 637 StreamlinesHashmap _streamlines; 632 638 VolumeHashmap _volumes; -
trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp
r3145 r3148 360 360 361 361 proc = Rappture::GetOpFromObj(interp, nAxisOps, axisOps, 362 Rappture::CMDSPEC_ARG1, objc, objv, 0); 363 if (proc == NULL) { 364 return TCL_ERROR; 365 } 366 return (*proc) (clientData, interp, objc, objv); 367 } 368 369 static int 370 BoxAddOp(ClientData clientData, Tcl_Interp *interp, int objc, 371 Tcl_Obj *const *objv) 372 { 373 const char *name = Tcl_GetString(objv[2]); 374 if (!g_renderer->addGraphicsObject<Box>(name)) { 375 Tcl_AppendResult(interp, "Failed to create box", (char*)NULL); 376 return TCL_ERROR; 377 } 378 return TCL_OK; 379 } 380 381 static int 382 BoxDeleteOp(ClientData clientData, Tcl_Interp *interp, int objc, 383 Tcl_Obj *const *objv) 384 { 385 if (objc == 3) { 386 const char *name = Tcl_GetString(objv[2]); 387 g_renderer->deleteGraphicsObject<Box>(name); 388 } else { 389 g_renderer->deleteGraphicsObject<Box>("all"); 390 } 391 return TCL_OK; 392 } 393 394 static int 395 BoxColorOp(ClientData clientData, Tcl_Interp *interp, int objc, 396 Tcl_Obj *const *objv) 397 { 398 float color[3]; 399 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK || 400 GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK || 401 GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) { 402 return TCL_ERROR; 403 } 404 if (objc == 6) { 405 const char *name = Tcl_GetString(objv[5]); 406 g_renderer->setGraphicsObjectColor<Box>(name, color); 407 } else { 408 g_renderer->setGraphicsObjectColor<Box>("all", color); 409 } 410 return TCL_OK; 411 } 412 413 static int 414 BoxEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc, 415 Tcl_Obj *const *objv) 416 { 417 bool state; 418 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 419 return TCL_ERROR; 420 } 421 if (objc == 4) { 422 const char *name = Tcl_GetString(objv[3]); 423 g_renderer->setGraphicsObjectEdgeVisibility<Box>(name, state); 424 } else { 425 g_renderer->setGraphicsObjectEdgeVisibility<Box>("all", state); 426 } 427 return TCL_OK; 428 } 429 430 static int 431 BoxLightingOp(ClientData clientData, Tcl_Interp *interp, int objc, 432 Tcl_Obj *const *objv) 433 { 434 bool state; 435 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 436 return TCL_ERROR; 437 } 438 if (objc == 4) { 439 const char *name = Tcl_GetString(objv[3]); 440 g_renderer->setGraphicsObjectLighting<Box>(name, state); 441 } else { 442 g_renderer->setGraphicsObjectLighting<Box>("all", state); 443 } 444 return TCL_OK; 445 } 446 447 static int 448 BoxLineColorOp(ClientData clientData, Tcl_Interp *interp, int objc, 449 Tcl_Obj *const *objv) 450 { 451 float color[3]; 452 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK || 453 GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK || 454 GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) { 455 return TCL_ERROR; 456 } 457 if (objc == 6) { 458 const char *name = Tcl_GetString(objv[5]); 459 g_renderer->setGraphicsObjectEdgeColor<Box>(name, color); 460 } else { 461 g_renderer->setGraphicsObjectEdgeColor<Box>("all", color); 462 } 463 return TCL_OK; 464 } 465 466 static int 467 BoxLineWidthOp(ClientData clientData, Tcl_Interp *interp, int objc, 468 Tcl_Obj *const *objv) 469 { 470 float width; 471 if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) { 472 return TCL_ERROR; 473 } 474 if (objc == 4) { 475 const char *name = Tcl_GetString(objv[3]); 476 g_renderer->setGraphicsObjectEdgeWidth<Box>(name, width); 477 } else { 478 g_renderer->setGraphicsObjectEdgeWidth<Box>("all", width); 479 } 480 return TCL_OK; 481 } 482 483 static int 484 BoxMaterialOp(ClientData clientData, Tcl_Interp *interp, int objc, 485 Tcl_Obj *const *objv) 486 { 487 double ambient, diffuse, specCoeff, specPower; 488 if (Tcl_GetDoubleFromObj(interp, objv[2], &ambient) != TCL_OK || 489 Tcl_GetDoubleFromObj(interp, objv[3], &diffuse) != TCL_OK || 490 Tcl_GetDoubleFromObj(interp, objv[4], &specCoeff) != TCL_OK || 491 Tcl_GetDoubleFromObj(interp, objv[5], &specPower) != TCL_OK) { 492 return TCL_ERROR; 493 } 494 495 if (objc == 7) { 496 const char *name = Tcl_GetString(objv[6]); 497 g_renderer->setGraphicsObjectAmbient<Box>(name, ambient); 498 g_renderer->setGraphicsObjectDiffuse<Box>(name, diffuse); 499 g_renderer->setGraphicsObjectSpecular<Box>(name, specCoeff, specPower); 500 } else { 501 g_renderer->setGraphicsObjectAmbient<Box>("all", ambient); 502 g_renderer->setGraphicsObjectDiffuse<Box>("all", diffuse); 503 g_renderer->setGraphicsObjectSpecular<Box>("all", specCoeff, specPower); 504 } 505 return TCL_OK; 506 } 507 508 static int 509 BoxOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc, 510 Tcl_Obj *const *objv) 511 { 512 double opacity; 513 if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) { 514 return TCL_ERROR; 515 } 516 if (objc == 4) { 517 const char *name = Tcl_GetString(objv[3]); 518 g_renderer->setGraphicsObjectOpacity<Box>(name, opacity); 519 } else { 520 g_renderer->setGraphicsObjectOpacity<Box>("all", opacity); 521 } 522 return TCL_OK; 523 } 524 525 static int 526 BoxOrientOp(ClientData clientData, Tcl_Interp *interp, int objc, 527 Tcl_Obj *const *objv) 528 { 529 double quat[4]; 530 if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK || 531 Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK || 532 Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK || 533 Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) { 534 return TCL_ERROR; 535 } 536 if (objc == 7) { 537 const char *name = Tcl_GetString(objv[6]); 538 g_renderer->setGraphicsObjectOrientation<Box>(name, quat); 539 } else { 540 g_renderer->setGraphicsObjectOrientation<Box>("all", quat); 541 } 542 return TCL_OK; 543 } 544 545 static int 546 BoxPositionOp(ClientData clientData, Tcl_Interp *interp, int objc, 547 Tcl_Obj *const *objv) 548 { 549 double pos[3]; 550 if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK || 551 Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK || 552 Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) { 553 return TCL_ERROR; 554 } 555 if (objc == 6) { 556 const char *name = Tcl_GetString(objv[5]); 557 g_renderer->setGraphicsObjectPosition<Box>(name, pos); 558 } else { 559 g_renderer->setGraphicsObjectPosition<Box>("all", pos); 560 } 561 return TCL_OK; 562 } 563 564 static int 565 BoxScaleOp(ClientData clientData, Tcl_Interp *interp, int objc, 566 Tcl_Obj *const *objv) 567 { 568 double scale[3]; 569 if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK || 570 Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK || 571 Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) { 572 return TCL_ERROR; 573 } 574 if (objc == 6) { 575 const char *name = Tcl_GetString(objv[5]); 576 g_renderer->setGraphicsObjectScale<Box>(name, scale); 577 } else { 578 g_renderer->setGraphicsObjectScale<Box>("all", scale); 579 } 580 return TCL_OK; 581 } 582 583 static int 584 BoxVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc, 585 Tcl_Obj *const *objv) 586 { 587 bool state; 588 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 589 return TCL_ERROR; 590 } 591 if (objc == 4) { 592 const char *name = Tcl_GetString(objv[3]); 593 g_renderer->setGraphicsObjectVisibility<Box>(name, state); 594 } else { 595 g_renderer->setGraphicsObjectVisibility<Box>("all", state); 596 } 597 return TCL_OK; 598 } 599 600 static int 601 BoxWireframeOp(ClientData clientData, Tcl_Interp *interp, int objc, 602 Tcl_Obj *const *objv) 603 { 604 bool state; 605 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 606 return TCL_ERROR; 607 } 608 if (objc == 4) { 609 const char *name = Tcl_GetString(objv[3]); 610 g_renderer->setGraphicsObjectWireframe<Box>(name, state); 611 } else { 612 g_renderer->setGraphicsObjectWireframe<Box>("all", state); 613 } 614 return TCL_OK; 615 } 616 617 static Rappture::CmdSpec boxOps[] = { 618 {"add", 1, BoxAddOp, 3, 3, "name"}, 619 {"color", 1, BoxColorOp, 5, 6, "r g b ?name?"}, 620 {"delete", 1, BoxDeleteOp, 2, 3, "?name?"}, 621 {"edges", 1, BoxEdgeVisibilityOp, 3, 4, "bool ?name?"}, 622 {"lighting", 3, BoxLightingOp, 3, 4, "bool ?name?"}, 623 {"linecolor", 5, BoxLineColorOp, 5, 6, "r g b ?name?"}, 624 {"linewidth", 5, BoxLineWidthOp, 3, 4, "width ?name?"}, 625 {"material", 1, BoxMaterialOp, 6, 7, "ambientCoeff diffuseCoeff specularCoeff specularPower ?name?"}, 626 {"opacity", 2, BoxOpacityOp, 3, 4, "value ?name?"}, 627 {"orient", 2, BoxOrientOp, 6, 7, "qw qx qy qz ?name?"}, 628 {"pos", 2, BoxPositionOp, 5, 6, "x y z ?name?"}, 629 {"scale", 1, BoxScaleOp, 5, 6, "sx sy sz ?name?"}, 630 {"visible", 1, BoxVisibleOp, 3, 4, "bool ?name?"}, 631 {"wireframe", 1, BoxWireframeOp, 3, 4, "bool ?name?"} 632 }; 633 static int nBoxOps = NumCmdSpecs(boxOps); 634 635 static int 636 BoxCmd(ClientData clientData, Tcl_Interp *interp, int objc, 637 Tcl_Obj *const *objv) 638 { 639 Tcl_ObjCmdProc *proc; 640 641 proc = Rappture::GetOpFromObj(interp, nBoxOps, boxOps, 362 642 Rappture::CMDSPEC_ARG1, objc, objv, 0); 363 643 if (proc == NULL) { … … 4082 4362 4083 4363 static int 4364 PolyDataMaterialOp(ClientData clientData, Tcl_Interp *interp, int objc, 4365 Tcl_Obj *const *objv) 4366 { 4367 double ambient, diffuse, specCoeff, specPower; 4368 if (Tcl_GetDoubleFromObj(interp, objv[2], &ambient) != TCL_OK || 4369 Tcl_GetDoubleFromObj(interp, objv[3], &diffuse) != TCL_OK || 4370 Tcl_GetDoubleFromObj(interp, objv[4], &specCoeff) != TCL_OK || 4371 Tcl_GetDoubleFromObj(interp, objv[5], &specPower) != TCL_OK) { 4372 return TCL_ERROR; 4373 } 4374 4375 if (objc == 7) { 4376 const char *name = Tcl_GetString(objv[6]); 4377 g_renderer->setGraphicsObjectAmbient<PolyData>(name, ambient); 4378 g_renderer->setGraphicsObjectDiffuse<PolyData>(name, diffuse); 4379 g_renderer->setGraphicsObjectSpecular<PolyData>(name, specCoeff, specPower); 4380 } else { 4381 g_renderer->setGraphicsObjectAmbient<PolyData>("all", ambient); 4382 g_renderer->setGraphicsObjectDiffuse<PolyData>("all", diffuse); 4383 g_renderer->setGraphicsObjectSpecular<PolyData>("all", specCoeff, specPower); 4384 } 4385 return TCL_OK; 4386 } 4387 4388 static int 4084 4389 PolyDataOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc, 4085 4390 Tcl_Obj *const *objv) … … 4215 4520 {"linecolor", 5, PolyDataLineColorOp, 5, 6, "r g b ?dataSetName?"}, 4216 4521 {"linewidth", 5, PolyDataLineWidthOp, 3, 4, "width ?dataSetName?"}, 4522 {"material", 1, PolyDataMaterialOp, 6, 7, "ambientCoeff diffuseCoeff specularCoeff specularPower ?dataSetName?"}, 4217 4523 {"opacity", 2, PolyDataOpacityOp, 3, 4, "value ?dataSetName?"}, 4218 4524 {"orient", 2, PolyDataOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"}, … … 4680 4986 4681 4987 proc = Rappture::GetOpFromObj(interp, nScreenOps, screenOps, 4988 Rappture::CMDSPEC_ARG1, objc, objv, 0); 4989 if (proc == NULL) { 4990 return TCL_ERROR; 4991 } 4992 return (*proc) (clientData, interp, objc, objv); 4993 } 4994 4995 static int 4996 SphereAddOp(ClientData clientData, Tcl_Interp *interp, int objc, 4997 Tcl_Obj *const *objv) 4998 { 4999 const char *name = Tcl_GetString(objv[2]); 5000 if (!g_renderer->addGraphicsObject<Sphere>(name)) { 5001 Tcl_AppendResult(interp, "Failed to create box", (char*)NULL); 5002 return TCL_ERROR; 5003 } 5004 return TCL_OK; 5005 } 5006 5007 static int 5008 SphereDeleteOp(ClientData clientData, Tcl_Interp *interp, int objc, 5009 Tcl_Obj *const *objv) 5010 { 5011 if (objc == 3) { 5012 const char *name = Tcl_GetString(objv[2]); 5013 g_renderer->deleteGraphicsObject<Sphere>(name); 5014 } else { 5015 g_renderer->deleteGraphicsObject<Sphere>("all"); 5016 } 5017 return TCL_OK; 5018 } 5019 5020 static int 5021 SphereColorOp(ClientData clientData, Tcl_Interp *interp, int objc, 5022 Tcl_Obj *const *objv) 5023 { 5024 float color[3]; 5025 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK || 5026 GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK || 5027 GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) { 5028 return TCL_ERROR; 5029 } 5030 if (objc == 6) { 5031 const char *name = Tcl_GetString(objv[5]); 5032 g_renderer->setGraphicsObjectColor<Sphere>(name, color); 5033 } else { 5034 g_renderer->setGraphicsObjectColor<Sphere>("all", color); 5035 } 5036 return TCL_OK; 5037 } 5038 5039 static int 5040 SphereEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc, 5041 Tcl_Obj *const *objv) 5042 { 5043 bool state; 5044 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 5045 return TCL_ERROR; 5046 } 5047 if (objc == 4) { 5048 const char *name = Tcl_GetString(objv[3]); 5049 g_renderer->setGraphicsObjectEdgeVisibility<Sphere>(name, state); 5050 } else { 5051 g_renderer->setGraphicsObjectEdgeVisibility<Sphere>("all", state); 5052 } 5053 return TCL_OK; 5054 } 5055 5056 static int 5057 SphereLightingOp(ClientData clientData, Tcl_Interp *interp, int objc, 5058 Tcl_Obj *const *objv) 5059 { 5060 bool state; 5061 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 5062 return TCL_ERROR; 5063 } 5064 if (objc == 4) { 5065 const char *name = Tcl_GetString(objv[3]); 5066 g_renderer->setGraphicsObjectLighting<Sphere>(name, state); 5067 } else { 5068 g_renderer->setGraphicsObjectLighting<Sphere>("all", state); 5069 } 5070 return TCL_OK; 5071 } 5072 5073 static int 5074 SphereLineColorOp(ClientData clientData, Tcl_Interp *interp, int objc, 5075 Tcl_Obj *const *objv) 5076 { 5077 float color[3]; 5078 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK || 5079 GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK || 5080 GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) { 5081 return TCL_ERROR; 5082 } 5083 if (objc == 6) { 5084 const char *name = Tcl_GetString(objv[5]); 5085 g_renderer->setGraphicsObjectEdgeColor<Sphere>(name, color); 5086 } else { 5087 g_renderer->setGraphicsObjectEdgeColor<Sphere>("all", color); 5088 } 5089 return TCL_OK; 5090 } 5091 5092 static int 5093 SphereLineWidthOp(ClientData clientData, Tcl_Interp *interp, int objc, 5094 Tcl_Obj *const *objv) 5095 { 5096 float width; 5097 if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) { 5098 return TCL_ERROR; 5099 } 5100 if (objc == 4) { 5101 const char *name = Tcl_GetString(objv[3]); 5102 g_renderer->setGraphicsObjectEdgeWidth<Sphere>(name, width); 5103 } else { 5104 g_renderer->setGraphicsObjectEdgeWidth<Sphere>("all", width); 5105 } 5106 return TCL_OK; 5107 } 5108 5109 static int 5110 SphereMaterialOp(ClientData clientData, Tcl_Interp *interp, int objc, 5111 Tcl_Obj *const *objv) 5112 { 5113 double ambient, diffuse, specCoeff, specPower; 5114 if (Tcl_GetDoubleFromObj(interp, objv[2], &ambient) != TCL_OK || 5115 Tcl_GetDoubleFromObj(interp, objv[3], &diffuse) != TCL_OK || 5116 Tcl_GetDoubleFromObj(interp, objv[4], &specCoeff) != TCL_OK || 5117 Tcl_GetDoubleFromObj(interp, objv[5], &specPower) != TCL_OK) { 5118 return TCL_ERROR; 5119 } 5120 5121 if (objc == 7) { 5122 const char *name = Tcl_GetString(objv[6]); 5123 g_renderer->setGraphicsObjectAmbient<Sphere>(name, ambient); 5124 g_renderer->setGraphicsObjectDiffuse<Sphere>(name, diffuse); 5125 g_renderer->setGraphicsObjectSpecular<Sphere>(name, specCoeff, specPower); 5126 } else { 5127 g_renderer->setGraphicsObjectAmbient<Sphere>("all", ambient); 5128 g_renderer->setGraphicsObjectDiffuse<Sphere>("all", diffuse); 5129 g_renderer->setGraphicsObjectSpecular<Sphere>("all", specCoeff, specPower); 5130 } 5131 return TCL_OK; 5132 } 5133 5134 static int 5135 SphereOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc, 5136 Tcl_Obj *const *objv) 5137 { 5138 double opacity; 5139 if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) { 5140 return TCL_ERROR; 5141 } 5142 if (objc == 4) { 5143 const char *name = Tcl_GetString(objv[3]); 5144 g_renderer->setGraphicsObjectOpacity<Sphere>(name, opacity); 5145 } else { 5146 g_renderer->setGraphicsObjectOpacity<Sphere>("all", opacity); 5147 } 5148 return TCL_OK; 5149 } 5150 5151 static int 5152 SphereOrientOp(ClientData clientData, Tcl_Interp *interp, int objc, 5153 Tcl_Obj *const *objv) 5154 { 5155 double quat[4]; 5156 if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK || 5157 Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK || 5158 Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK || 5159 Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) { 5160 return TCL_ERROR; 5161 } 5162 if (objc == 7) { 5163 const char *name = Tcl_GetString(objv[6]); 5164 g_renderer->setGraphicsObjectOrientation<Sphere>(name, quat); 5165 } else { 5166 g_renderer->setGraphicsObjectOrientation<Sphere>("all", quat); 5167 } 5168 return TCL_OK; 5169 } 5170 5171 static int 5172 SpherePositionOp(ClientData clientData, Tcl_Interp *interp, int objc, 5173 Tcl_Obj *const *objv) 5174 { 5175 double pos[3]; 5176 if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK || 5177 Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK || 5178 Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) { 5179 return TCL_ERROR; 5180 } 5181 if (objc == 6) { 5182 const char *name = Tcl_GetString(objv[5]); 5183 g_renderer->setGraphicsObjectPosition<Sphere>(name, pos); 5184 } else { 5185 g_renderer->setGraphicsObjectPosition<Sphere>("all", pos); 5186 } 5187 return TCL_OK; 5188 } 5189 5190 static int 5191 SphereScaleOp(ClientData clientData, Tcl_Interp *interp, int objc, 5192 Tcl_Obj *const *objv) 5193 { 5194 double scale[3]; 5195 if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK || 5196 Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK || 5197 Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) { 5198 return TCL_ERROR; 5199 } 5200 if (objc == 6) { 5201 const char *name = Tcl_GetString(objv[5]); 5202 g_renderer->setGraphicsObjectScale<Sphere>(name, scale); 5203 } else { 5204 g_renderer->setGraphicsObjectScale<Sphere>("all", scale); 5205 } 5206 return TCL_OK; 5207 } 5208 5209 static int 5210 SphereVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc, 5211 Tcl_Obj *const *objv) 5212 { 5213 bool state; 5214 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 5215 return TCL_ERROR; 5216 } 5217 if (objc == 4) { 5218 const char *name = Tcl_GetString(objv[3]); 5219 g_renderer->setGraphicsObjectVisibility<Sphere>(name, state); 5220 } else { 5221 g_renderer->setGraphicsObjectVisibility<Sphere>("all", state); 5222 } 5223 return TCL_OK; 5224 } 5225 5226 static int 5227 SphereWireframeOp(ClientData clientData, Tcl_Interp *interp, int objc, 5228 Tcl_Obj *const *objv) 5229 { 5230 bool state; 5231 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 5232 return TCL_ERROR; 5233 } 5234 if (objc == 4) { 5235 const char *name = Tcl_GetString(objv[3]); 5236 g_renderer->setGraphicsObjectWireframe<Sphere>(name, state); 5237 } else { 5238 g_renderer->setGraphicsObjectWireframe<Sphere>("all", state); 5239 } 5240 return TCL_OK; 5241 } 5242 5243 static Rappture::CmdSpec sphereOps[] = { 5244 {"add", 1, SphereAddOp, 3, 3, "name"}, 5245 {"color", 1, SphereColorOp, 5, 6, "r g b ?name?"}, 5246 {"delete", 1, SphereDeleteOp, 2, 3, "?name?"}, 5247 {"edges", 1, SphereEdgeVisibilityOp, 3, 4, "bool ?name?"}, 5248 {"lighting", 3, SphereLightingOp, 3, 4, "bool ?name?"}, 5249 {"linecolor", 5, SphereLineColorOp, 5, 6, "r g b ?name?"}, 5250 {"linewidth", 5, SphereLineWidthOp, 3, 4, "width ?name?"}, 5251 {"material", 1, SphereMaterialOp, 6, 7, "ambientCoeff diffuseCoeff specularCoeff specularPower ?name?"}, 5252 {"opacity", 2, SphereOpacityOp, 3, 4, "value ?name?"}, 5253 {"orient", 2, SphereOrientOp, 6, 7, "qw qx qy qz ?name?"}, 5254 {"pos", 2, SpherePositionOp, 5, 6, "x y z ?name?"}, 5255 {"scale", 1, SphereScaleOp, 5, 6, "sx sy sz ?name?"}, 5256 {"visible", 1, SphereVisibleOp, 3, 4, "bool ?name?"}, 5257 {"wireframe", 1, SphereWireframeOp, 3, 4, "bool ?name?"} 5258 }; 5259 static int nSphereOps = NumCmdSpecs(sphereOps); 5260 5261 static int 5262 SphereCmd(ClientData clientData, Tcl_Interp *interp, int objc, 5263 Tcl_Obj *const *objv) 5264 { 5265 Tcl_ObjCmdProc *proc; 5266 5267 proc = Rappture::GetOpFromObj(interp, nSphereOps, sphereOps, 4682 5268 Rappture::CMDSPEC_ARG1, objc, objv, 0); 4683 5269 if (proc == NULL) { … … 6066 6652 Tcl_MakeSafe(interp); 6067 6653 Tcl_CreateObjCommand(interp, "axis", AxisCmd, clientData, NULL); 6654 Tcl_CreateObjCommand(interp, "box", BoxCmd, clientData, NULL); 6068 6655 Tcl_CreateObjCommand(interp, "camera", CameraCmd, clientData, NULL); 6069 6656 Tcl_CreateObjCommand(interp, "colormap", ColorMapCmd, clientData, NULL); … … 6082 6669 Tcl_CreateObjCommand(interp, "renderer", RendererCmd, clientData, NULL); 6083 6670 Tcl_CreateObjCommand(interp, "screen", ScreenCmd, clientData, NULL); 6671 Tcl_CreateObjCommand(interp, "sphere", SphereCmd, clientData, NULL); 6084 6672 Tcl_CreateObjCommand(interp, "streamlines", StreamlinesCmd, clientData, NULL); 6085 6673 Tcl_CreateObjCommand(interp, "volume", VolumeCmd, clientData, NULL); … … 6094 6682 6095 6683 Tcl_DeleteCommand(interp, "axis"); 6684 Tcl_DeleteCommand(interp, "box"); 6096 6685 Tcl_DeleteCommand(interp, "camera"); 6097 6686 Tcl_DeleteCommand(interp, "colormap"); … … 6110 6699 Tcl_DeleteCommand(interp, "renderer"); 6111 6700 Tcl_DeleteCommand(interp, "screen"); 6701 Tcl_DeleteCommand(interp, "sphere"); 6112 6702 Tcl_DeleteCommand(interp, "streamlines"); 6113 6703 Tcl_DeleteCommand(interp, "volume"); -
trunk/packages/vizservers/vtkvis/RpVtkRendererGraphicsObjs.cpp
r3145 r3148 16 16 #include "RpVtkRenderer.h" 17 17 #include "RpVtkDataSet.h" 18 #include "RpBox.h" 18 19 #include "RpContour2D.h" 19 20 #include "RpContour3D.h" … … 25 26 #include "RpPolyData.h" 26 27 #include "RpPseudoColor.h" 28 #include "RpSphere.h" 27 29 #include "RpStreamlines.h" 28 30 #include "RpVolume.h" … … 35 37 36 38 template<> 39 Renderer::BoxHashmap & 40 Renderer::getGraphicsObjectHashmap<Box>() 41 { return _boxes; } 42 43 template<> 37 44 Renderer::Contour2DHashmap & 38 45 Renderer::getGraphicsObjectHashmap<Contour2D>() … … 80 87 81 88 template<> 89 Renderer::SphereHashmap & 90 Renderer::getGraphicsObjectHashmap<Sphere>() 91 { return _spheres; } 92 93 template<> 82 94 Renderer::StreamlinesHashmap & 83 95 Renderer::getGraphicsObjectHashmap<Streamlines>() … … 93 105 Renderer::getGraphicsObjectHashmap<Warp>() 94 106 { return _warps; } 107 108 template <> 109 bool Renderer::addGraphicsObject<Box>(const DataSetId& id) 110 { 111 Box *gobj; 112 if ((gobj = getGraphicsObject<Box>(id)) != NULL) { 113 WARN("Replacing existing %s %s", gobj->getClassName(), id.c_str()); 114 deleteGraphicsObject<Box>(id); 115 } 116 117 gobj = new Box(); 118 119 gobj->setDataSet(NULL, this); 120 121 if (gobj->getProp() == NULL && 122 gobj->getOverlayProp() == NULL) { 123 delete gobj; 124 return false; 125 } else { 126 if (gobj->getProp()) 127 _renderer->AddViewProp(gobj->getProp()); 128 if (gobj->getOverlayProp()) 129 _renderer->AddViewProp(gobj->getOverlayProp()); 130 } 131 132 getGraphicsObjectHashmap<Box>()[id] = gobj; 133 134 initCamera(); 135 _needsRedraw = true; 136 return true; 137 } 138 139 template <> 140 bool Renderer::addGraphicsObject<Sphere>(const DataSetId& id) 141 { 142 Sphere *gobj; 143 if ((gobj = getGraphicsObject<Sphere>(id)) != NULL) { 144 WARN("Replacing existing %s %s", gobj->getClassName(), id.c_str()); 145 deleteGraphicsObject<Sphere>(id); 146 } 147 148 gobj = new Sphere(); 149 150 gobj->setDataSet(NULL, this); 151 152 if (gobj->getProp() == NULL && 153 gobj->getOverlayProp() == NULL) { 154 delete gobj; 155 return false; 156 } else { 157 if (gobj->getProp()) 158 _renderer->AddViewProp(gobj->getProp()); 159 if (gobj->getOverlayProp()) 160 _renderer->AddViewProp(gobj->getOverlayProp()); 161 } 162 163 getGraphicsObjectHashmap<Sphere>()[id] = gobj; 164 165 initCamera(); 166 _needsRedraw = true; 167 return true; 168 } 95 169 96 170 /** -
trunk/packages/vizservers/vtkvis/protocol.txt
r3145 r3148 128 128 Set the active vector field to plot 129 129 dataset visible <bool> <?datasetName?> 130 131 box add <name> 132 box color <r> <g> <b> <?name?> 133 box delete <?name?> 134 box edges <bool> <?name?> 135 box lighting <bool> <?name?> 136 box linecolor <r> <g> <b> <?name?> 137 box linewidth <val> <?name?> 138 box material <ambientCoeff> <diffuseCoeff> <specularCoeff> <specularExp> 139 box opacity <val> <?datasetName?> 140 box orient <qw> <qx> <qy> <qz> <?name?> 141 box pos <x> <y> <z> <?name?> 142 box scale <sx> <sy> <sz> <?name?> 143 box visible <bool> <?name?> 144 box wireframe <bool> <?name?> 130 145 131 146 contour2d add numcontours <n> <?datasetName?> … … 317 332 polydata linecolor <r> <g> <b> <?datasetName?> 318 333 polydata linewidth <val> <?datasetName?> 334 polydata material <ambientCoeff> <diffuseCoeff> <specularCoeff> <specularExp> 319 335 polydata opacity <val> <?datasetName?> 320 336 polydata orient <qw> <qx> <qy> <qz> <?dataSetName?> … … 345 361 pseudocolor visible <bool> <?datasetName?> 346 362 pseudocolor wireframe <bool> <?datasetName?> 363 364 sphere add <name> 365 sphere color <r> <g> <b> <?name?> 366 sphere delete <?name?> 367 sphere edges <bool> <?name?> 368 sphere lighting <bool> <?name?> 369 sphere linecolor <r> <g> <b> <?name?> 370 sphere linewidth <val> <?name?> 371 sphere material <ambientCoeff> <diffuseCoeff> <specularCoeff> <specularExp> 372 sphere opacity <val> <?datasetName?> 373 sphere orient <qw> <qx> <qy> <qz> <?name?> 374 sphere pos <x> <y> <z> <?name?> 375 sphere scale <sx> <sy> <sz> <?name?> 376 sphere visible <bool> <?name?> 377 sphere wireframe <bool> <?name?> 347 378 348 379 streamlines add <?datasetName?>
Note: See TracChangeset
for help on using the changeset viewer.