Changeset 3149 for trunk/packages
- Timestamp:
- Aug 23, 2012, 2:55:39 PM (12 years ago)
- Location:
- trunk/packages/vizservers/vtkvis
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/RpVtkRenderer.h
r3148 r3149 476 476 const char *name, double range[2] = NULL); 477 477 478 // Spheres 479 480 void setSphereSection(const DataSetId& id, double thetaStart, double thetaEnd, 481 double phiStart, double phiEnd); 482 483 void setSphereResolution(const DataSetId& id, int thetaRes, int phiRes); 484 478 485 // Streamlines 479 486 -
trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp
r3148 r3149 5189 5189 5190 5190 static int 5191 SphereResolutionOp(ClientData clientData, Tcl_Interp *interp, int objc, 5192 Tcl_Obj *const *objv) 5193 { 5194 int theta, phi; 5195 if (Tcl_GetIntFromObj(interp, objv[2], &theta) != TCL_OK || 5196 Tcl_GetIntFromObj(interp, objv[3], &phi) != TCL_OK) { 5197 return TCL_ERROR; 5198 } 5199 if (objc == 5) { 5200 const char *name = Tcl_GetString(objv[4]); 5201 g_renderer->setSphereResolution(name, theta, phi); 5202 } else { 5203 g_renderer->setSphereResolution("all", theta, phi); 5204 } 5205 return TCL_OK; 5206 } 5207 5208 static int 5191 5209 SphereScaleOp(ClientData clientData, Tcl_Interp *interp, int objc, 5192 5210 Tcl_Obj *const *objv) … … 5203 5221 } else { 5204 5222 g_renderer->setGraphicsObjectScale<Sphere>("all", scale); 5223 } 5224 return TCL_OK; 5225 } 5226 5227 static int 5228 SphereSectionOp(ClientData clientData, Tcl_Interp *interp, int objc, 5229 Tcl_Obj *const *objv) 5230 { 5231 double thetaStart, thetaEnd, phiStart, phiEnd; 5232 if (Tcl_GetDoubleFromObj(interp, objv[2], &thetaStart) != TCL_OK || 5233 Tcl_GetDoubleFromObj(interp, objv[3], &thetaEnd) != TCL_OK || 5234 Tcl_GetDoubleFromObj(interp, objv[4], &phiStart) != TCL_OK || 5235 Tcl_GetDoubleFromObj(interp, objv[5], &phiEnd) != TCL_OK) { 5236 return TCL_ERROR; 5237 } 5238 if (objc == 7) { 5239 const char *name = Tcl_GetString(objv[6]); 5240 g_renderer->setSphereSection(name, thetaStart, thetaEnd, phiStart, phiEnd); 5241 } else { 5242 g_renderer->setSphereSection("all", thetaStart, thetaEnd, phiStart, phiEnd); 5205 5243 } 5206 5244 return TCL_OK; … … 5253 5291 {"orient", 2, SphereOrientOp, 6, 7, "qw qx qy qz ?name?"}, 5254 5292 {"pos", 2, SpherePositionOp, 5, 6, "x y z ?name?"}, 5255 {"scale", 1, SphereScaleOp, 5, 6, "sx sy sz ?name?"}, 5293 {"resolution",1, SphereResolutionOp, 4, 5, "thetaRes phiRes ?name?"}, 5294 {"scale", 2, SphereScaleOp, 5, 6, "sx sy sz ?name?"}, 5295 {"section", 2, SphereSectionOp, 6, 7, "thetaStart thetaEnd phiStart phiEnd ?name?"}, 5256 5296 {"visible", 1, SphereVisibleOp, 3, 4, "bool ?name?"}, 5257 5297 {"wireframe", 1, SphereWireframeOp, 3, 4, "bool ?name?"} -
trunk/packages/vizservers/vtkvis/RpVtkRendererGraphicsObjs.cpp
r3148 r3149 1522 1522 1523 1523 /** 1524 * \brief Set Sphere resolution 1525 */ 1526 void Renderer::setSphereResolution(const DataSetId& id, int thetaRes, int phiRes) 1527 { 1528 SphereHashmap::iterator itr; 1529 1530 bool doAll = false; 1531 1532 if (id.compare("all") == 0) { 1533 itr = _spheres.begin(); 1534 doAll = true; 1535 } else { 1536 itr = _spheres.find(id); 1537 } 1538 if (itr == _spheres.end()) { 1539 ERROR("Sphere not found: %s", id.c_str()); 1540 return; 1541 } 1542 1543 do { 1544 itr->second->setThetaResolution(thetaRes); 1545 itr->second->setPhiResolution(phiRes); 1546 } while (doAll && ++itr != _spheres.end()); 1547 1548 _needsRedraw = true; 1549 } 1550 1551 1552 /** 1553 * \brief Set Sphere section 1554 */ 1555 void Renderer::setSphereSection(const DataSetId& id, double thetaStart, double thetaEnd, 1556 double phiStart, double phiEnd) 1557 { 1558 SphereHashmap::iterator itr; 1559 1560 bool doAll = false; 1561 1562 if (id.compare("all") == 0) { 1563 itr = _spheres.begin(); 1564 doAll = true; 1565 } else { 1566 itr = _spheres.find(id); 1567 } 1568 if (itr == _spheres.end()) { 1569 ERROR("Sphere not found: %s", id.c_str()); 1570 return; 1571 } 1572 1573 do { 1574 itr->second->setStartTheta(thetaStart); 1575 itr->second->setEndTheta(thetaEnd); 1576 itr->second->setStartPhi(phiStart); 1577 itr->second->setEndPhi(phiEnd); 1578 } while (doAll && ++itr != _spheres.end()); 1579 1580 _needsRedraw = true; 1581 } 1582 1583 /** 1524 1584 * \brief Set the streamlines seed to points of the streamlines DataSet 1525 1585 */ -
trunk/packages/vizservers/vtkvis/protocol.txt
r3148 r3149 373 373 sphere orient <qw> <qx> <qy> <qz> <?name?> 374 374 sphere pos <x> <y> <z> <?name?> 375 sphere resolution <thetaRes> <phiRes> <?name?> 375 376 sphere scale <sx> <sy> <sz> <?name?> 377 sphere section <thetaStart> <thetaEnd> <phiStart> <phiEnd> 378 Angles are in degrees 376 379 sphere visible <bool> <?name?> 377 380 sphere wireframe <bool> <?name?>
Note: See TracChangeset
for help on using the changeset viewer.