Changeset 3693
- Timestamp:
- Jun 16, 2013, 4:52:42 PM (11 years ago)
- Location:
- trunk/packages/vizservers/vtkvis
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/Molecule.cpp
r3676 r3693 242 242 243 243 // Atoms 244 vtkSmartPointer<vtkSphereSource> sphereSource = vtkSmartPointer<vtkSphereSource>::New(); 245 sphereSource->SetRadius(1.0); 246 sphereSource->SetThetaResolution(14); 247 sphereSource->SetPhiResolution(14); 248 249 _atomMapper->SetSourceConnection(sphereSource->GetOutputPort()); 244 if (_sphereSource == NULL) { 245 _sphereSource = vtkSmartPointer<vtkSphereSource>::New(); 246 _sphereSource->SetRadius(1.0); 247 _sphereSource->SetThetaResolution(14); 248 _sphereSource->SetPhiResolution(14); 249 } 250 251 _atomMapper->SetSourceConnection(_sphereSource->GetOutputPort()); 250 252 #ifdef USE_VTK6 251 253 _atomMapper->SetInputData(pd); … … 662 664 } 663 665 666 void Molecule::setAtomQuality(double quality) 667 { 668 if (_sphereSource == NULL) 669 return; 670 671 if (quality > 10.0) 672 quality = 10.0; 673 674 int thetaRes = (int)(quality * 14.0); 675 int phiRes = (int)(quality * 14.0); 676 if (thetaRes < 4) thetaRes = 4; 677 if (phiRes < 3) phiRes = 3; 678 679 _sphereSource->SetThetaResolution(thetaRes); 680 _sphereSource->SetPhiResolution(phiRes); 681 682 if (_atomMapper != NULL) { 683 _atomMapper->Modified(); 684 _atomMapper->Update(); 685 } 686 } 687 688 void Molecule::setBondQuality(double quality) 689 { 690 if (_cylinderSource == NULL) 691 return; 692 693 if (quality > 10.0) 694 quality = 10.0; 695 696 int res = (int)(quality * 12.0); 697 if (res < 3) res = 3; 698 699 _cylinderSource->SetResolution(res); 700 701 if (_bondMapper != NULL) { 702 _bondMapper->Modified(); 703 _bondMapper->Update(); 704 } 705 } 706 664 707 void Molecule::setBondStyle(BondStyle style) 665 708 { -
trunk/packages/vizservers/vtkvis/Molecule.h
r3641 r3693 17 17 #include <vtkGlyph3DMapper.h> 18 18 #include <vtkTransformPolyDataFilter.h> 19 #include <vtkSphereSource.h> 19 20 #include <vtkCylinderSource.h> 20 21 #include <vtkLineSource.h> … … 128 129 void setBondColorMode(BondColorMode mode); 129 130 131 void setAtomQuality(double quality); 132 133 void setBondQuality(double quality); 134 130 135 static ColorMap *createElementColorMap(); 131 136 … … 157 162 vtkSmartPointer<vtkActor> _bondProp; 158 163 vtkSmartPointer<vtkActor2D> _labelProp; 164 vtkSmartPointer<vtkSphereSource> _sphereSource; 159 165 vtkSmartPointer<vtkPolyData> _bondPD; 160 166 vtkSmartPointer<vtkCylinderSource> _cylinderSource; -
trunk/packages/vizservers/vtkvis/Renderer.h
r3683 r3693 742 742 // Molecules 743 743 744 void setMoleculeAtomQuality(const DataSetId& id, double quality); 745 746 void setMoleculeBondQuality(const DataSetId& id, double quality); 747 744 748 void setMoleculeAtomRadiusScale(const DataSetId& id, double scale); 745 749 -
trunk/packages/vizservers/vtkvis/RendererCmd.cpp
r3683 r3693 7332 7332 7333 7333 static int 7334 MoleculeAtomQualityOp(ClientData clientData, Tcl_Interp *interp, int objc, 7335 Tcl_Obj *const *objv) 7336 { 7337 double quality; 7338 if (Tcl_GetDoubleFromObj(interp, objv[2], &quality) != TCL_OK) { 7339 return TCL_ERROR; 7340 } 7341 if (objc == 4) { 7342 const char *name = Tcl_GetString(objv[3]); 7343 g_renderer->setMoleculeAtomQuality(name, quality); 7344 } else { 7345 g_renderer->setMoleculeAtomQuality("all", quality); 7346 } 7347 return TCL_OK; 7348 } 7349 7350 static int 7334 7351 MoleculeAtomScaleFactorOp(ClientData clientData, Tcl_Interp *interp, int objc, 7335 7352 Tcl_Obj *const *objv) … … 7415 7432 } else { 7416 7433 g_renderer->setMoleculeBondColor("all", color); 7434 } 7435 return TCL_OK; 7436 } 7437 7438 static int 7439 MoleculeBondQualityOp(ClientData clientData, Tcl_Interp *interp, int objc, 7440 Tcl_Obj *const *objv) 7441 { 7442 double quality; 7443 if (Tcl_GetDoubleFromObj(interp, objv[2], &quality) != TCL_OK) { 7444 return TCL_ERROR; 7445 } 7446 if (objc == 4) { 7447 const char *name = Tcl_GetString(objv[3]); 7448 g_renderer->setMoleculeBondQuality(name, quality); 7449 } else { 7450 g_renderer->setMoleculeBondQuality("all", quality); 7417 7451 } 7418 7452 return TCL_OK; … … 7747 7781 static Rappture::CmdSpec moleculeOps[] = { 7748 7782 {"add", 2, MoleculeAddOp, 2, 3, "?dataSetName?"}, 7783 {"aquality", 2, MoleculeAtomQualityOp, 3, 4, "value ?dataSetName?"}, 7749 7784 {"ascale", 2, MoleculeAtomScaleFactorOp, 3, 4, "value ?dataSetName?"}, 7750 7785 {"atoms", 2, MoleculeAtomVisibilityOp, 3, 4, "bool ?dataSetName?"}, … … 7752 7787 {"bcolor", 3, MoleculeBondColorOp, 5, 6, "r g b ?dataSetName?"}, 7753 7788 {"bonds", 2, MoleculeBondVisibilityOp, 3, 4, "bool ?dataSetName?"}, 7789 {"bquality", 2, MoleculeBondQualityOp, 3, 4, "value ?dataSetName?"}, 7754 7790 {"bscale", 3, MoleculeBondScaleFactorOp, 3, 4, "value ?dataSetName?"}, 7755 7791 {"bstyle", 3, MoleculeBondStyleOp, 3, 4, "value ?dataSetName?"}, -
trunk/packages/vizservers/vtkvis/RendererGraphicsObjs.cpp
r3683 r3693 2269 2269 2270 2270 /** 2271 * \brief Set atom sphere resolution 2272 */ 2273 void Renderer::setMoleculeAtomQuality(const DataSetId& id, double quality) 2274 { 2275 MoleculeHashmap::iterator itr; 2276 2277 bool doAll = false; 2278 2279 if (id.compare("all") == 0) { 2280 itr = _molecules.begin(); 2281 if (itr == _molecules.end()) 2282 return; 2283 doAll = true; 2284 } else { 2285 itr = _molecules.find(id); 2286 } 2287 if (itr == _molecules.end()) { 2288 ERROR("Molecule not found: %s", id.c_str()); 2289 return; 2290 } 2291 2292 do { 2293 itr->second->setAtomQuality(quality); 2294 } while (doAll && ++itr != _molecules.end()); 2295 2296 sceneBoundsChanged(); 2297 _needsRedraw = true; 2298 } 2299 2300 2301 /** 2302 * \brief Set bond cylinder resolution 2303 */ 2304 void Renderer::setMoleculeBondQuality(const DataSetId& id, double quality) 2305 { 2306 MoleculeHashmap::iterator itr; 2307 2308 bool doAll = false; 2309 2310 if (id.compare("all") == 0) { 2311 itr = _molecules.begin(); 2312 if (itr == _molecules.end()) 2313 return; 2314 doAll = true; 2315 } else { 2316 itr = _molecules.find(id); 2317 } 2318 if (itr == _molecules.end()) { 2319 ERROR("Molecule not found: %s", id.c_str()); 2320 return; 2321 } 2322 2323 do { 2324 itr->second->setBondQuality(quality); 2325 } while (doAll && ++itr != _molecules.end()); 2326 2327 sceneBoundsChanged(); 2328 _needsRedraw = true; 2329 } 2330 2331 2332 /** 2271 2333 * \brief Set radius scale factor for atoms 2272 2334 */ … … 3020 3082 * \param[in] data Bytes of VTK DataSet file 3021 3083 * \param[in] nbytes Length of data array 3084 * \param[in] maxPoints Maximum number of points to be used as seeds 3022 3085 * 3023 3086 * \return boolean indicating success or failure -
trunk/packages/vizservers/vtkvis/Streamlines.cpp
r3682 r3693 706 706 * 707 707 * \param[in] seed vtkDataSet with points to use as seeds 708 * \param[in] maxPoints Maximum number of points to be used as seeds 708 709 */ 709 710 void Streamlines::setSeedToMeshPoints(vtkDataSet *seed, int maxPoints) -
trunk/packages/vizservers/vtkvis/protocol.txt
r3683 r3693 591 591 592 592 molecule add <?datasetName?> 593 molecule aquality <val> <?datasetName?> 594 Set atom sphere resolution quality val=[0,10], 1 is default 595 molecule ascale <val> <?datasetName?> 596 Set atom scale factor 593 597 molecule atoms <bool> <?datasetName?> 594 598 Toggle rendering of atoms 595 molecule ascale <val> <?datasetName?>596 Set atom scale factor597 599 molecule bcmode <by_elements|constant> <?datasetName?> 598 600 Set bond color mode … … 601 603 molecule bonds <bool> <?datasetName?> 602 604 Toggle rendering of bonds 605 molecule bquality <val> <?datasetName?> 606 Set bond cylinder resolution quality val=[0,10], 1 is default 603 607 molecule bscale <val> <?datasetName?> 604 608 Set bond scale factor
Note: See TracChangeset
for help on using the changeset viewer.