Changeset 2320 for trunk/packages
- Timestamp:
- Jul 28, 2011, 1:31:48 PM (13 years ago)
- Location:
- trunk/packages/vizservers/vtkvis
- Files:
-
- 4 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/ColorMap.cpp
r2317 r2320 15 15 16 16 #include "ColorMap.h" 17 #include "RpMolecule.h" 17 18 #include "Trace.h" 18 19 … … 21 22 ColorMap *ColorMap::_default = NULL; 22 23 ColorMap *ColorMap::_volumeDefault = NULL; 24 ColorMap *ColorMap::_elementDefault = NULL; 23 25 24 26 ColorMap::ColorMap(const std::string& name) : … … 278 280 * \brief Create a default ColorMap with a blue-cyan-green-yellow-red ramp 279 281 */ 280 ColorMap * 282 ColorMap *ColorMap::getDefault() 281 283 { 282 284 if (_default != NULL) { … … 324 326 * and transparent to opaque ramp 325 327 */ 326 ColorMap * 328 ColorMap *ColorMap::getVolumeDefault() 327 329 { 328 330 if (_volumeDefault != NULL) { … … 365 367 return _volumeDefault; 366 368 } 369 370 /** 371 * \brief Create a default ColorMap for coloring by atomic 372 * number in Molecules 373 */ 374 ColorMap *ColorMap::getElementDefault() 375 { 376 if (_elementDefault != NULL) { 377 return _elementDefault; 378 } 379 380 _elementDefault = Molecule::createElementColorMap(); 381 return _elementDefault; 382 } -
trunk/packages/vizservers/vtkvis/ColorMap.h
r2261 r2320 105 105 static ColorMap *getDefault(); 106 106 static ColorMap *getVolumeDefault(); 107 static ColorMap *getElementDefault(); 107 108 108 109 private: 109 110 static ColorMap *_default; 110 111 static ColorMap *_volumeDefault; 112 static ColorMap *_elementDefault; 111 113 112 114 ColorMap(); -
trunk/packages/vizservers/vtkvis/Makefile.in
r2317 r2320 79 79 RpGlyphs.cpp \ 80 80 RpHeightMap.cpp \ 81 RpLIC.cpp \ 82 RpMolecule.cpp \ 81 83 RpPolyData.cpp \ 82 84 RpPseudoColor.cpp \ … … 125 127 126 128 CmdProc.o: CmdProc.h 127 ColorMap.o: ColorMap.h Trace.h129 ColorMap.o: ColorMap.h RpMolecule.h Trace.h 128 130 PPMWriter.o: PPMWriter.h Trace.h 129 131 RpContour2D.o: RpContour2D.h RpVtkDataSet.h Trace.h 130 132 RpContour3D.o: RpContour3D.h RpVtkDataSet.h Trace.h 131 RpPolyData.o: RpPolyData.h RpVtkDataSet.h Trace.h132 133 RpGlyphs.o: RpGlyphs.h RpVtkDataSet.h ColorMap.h Trace.h 133 134 RpHeightMap.o: RpHeightMap.h RpVtkDataSet.h Trace.h 135 RpLIC.o: RpLIC.h RpVtkDataSet.h Trace.h RpVtkRenderServer.h 136 RpMolecule.o: RpMolecule.h RpMoleculeData.h RpVtkDataSet.h ColorMap.h Trace.h 137 RpPolyData.o: RpPolyData.h RpVtkDataSet.h Trace.h 134 138 RpPseudoColor.o: RpPseudoColor.h RpVtkDataSet.h Trace.h 135 139 RpStreamlines.o: RpStreamlines.h RpVtkDataSet.h Trace.h 136 140 RpVolume.o: RpVolume.h RpVtkDataSet.h ColorMap.h Trace.h 137 141 RpVtkDataSet.o: RpVtkDataSet.h Trace.h 138 RpVtkRenderer.o: RpVtkRenderer.h RpVtkDataSet.h RpContour2D.h RpContour3D.h Rp PolyData.h RpGlyphs.h RpHeightMap.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h139 RpVtkRendererCmd.o: RpVtkRenderer.h RpVtkDataSet.h Rp PseudoColor.h RpContour2D.h Trace.h CmdProc.h ColorMap.h PPMWriter.h TGAWriter.h140 RpVtkRenderServer.o: RpVtkRenderServer.h RpVtkRenderer .h RpVtkDataSet.h RpPseudoColor.h RpContour2D.h Trace.h PPMWriter.h TGAWriter.h142 RpVtkRenderer.o: RpVtkRenderer.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h 143 RpVtkRendererCmd.o: RpVtkRenderer.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h CmdProc.h PPMWriter.h TGAWriter.h 144 RpVtkRenderServer.o: RpVtkRenderServer.h RpVtkRendererCmd.h RpVtkRenderer.h Trace.h PPMWriter.h TGAWriter.h 141 145 Trace.o: Trace.h 142 146 TGAWriter.o: TGAWriter.h Trace.h -
trunk/packages/vizservers/vtkvis/RpHeightMap.cpp
r2319 r2320 115 115 116 116 /** 117 * \brief Internal method to set up color mapperafter a state change117 * \brief Internal method to set up pipeline after a state change 118 118 */ 119 119 void HeightMap::update() … … 482 482 483 483 if (_volumeSlicer == NULL && 484 484 _probeFilter == NULL) { 485 485 WARN("Called before update() or DataSet is not a volume"); 486 486 return; … … 589 589 } 590 590 591 _volumeSlicer->SetVOI(voi [0], voi[1], voi[2], voi[3], voi[4], voi[5]);591 _volumeSlicer->SetVOI(voi); 592 592 } 593 593 -
trunk/packages/vizservers/vtkvis/RpPolyData.cpp
r2317 r2320 95 95 96 96 /** 97 * \brief Internal method to re-compute contoursafter a state change97 * \brief Internal method to set up pipeline after a state change 98 98 */ 99 99 void PolyData::update() -
trunk/packages/vizservers/vtkvis/RpPolyData.h
r2261 r2320 12 12 #include <vtkPolyDataMapper.h> 13 13 #include <vtkActor.h> 14 15 #include <vector>16 14 17 15 #include "RpVtkDataSet.h" -
trunk/packages/vizservers/vtkvis/RpPseudoColor.cpp
r2317 r2320 71 71 72 72 /** 73 * \brief Internal method to set up color mapperafter a state change73 * \brief Internal method to set up pipeline after a state change 74 74 */ 75 75 void PseudoColor::update() -
trunk/packages/vizservers/vtkvis/RpPseudoColor.h
r2317 r2320 14 14 #include <vtkActor.h> 15 15 #include <vtkPlaneCollection.h> 16 17 #include <vector>18 16 19 17 #include "RpVtkDataSet.h" -
trunk/packages/vizservers/vtkvis/RpVolume.cpp
r2270 r2320 46 46 * \brief Specify input DataSet with scalars 47 47 * 48 * Currently the DataSet must be image data ( 2D uniform grid),48 * Currently the DataSet must be image data (3D uniform grid), 49 49 * or an UnstructuredGrid 50 50 */ … … 66 66 67 67 /** 68 * \brief Internal method to set up volume mapperafter a state change68 * \brief Internal method to set up pipeline after a state change 69 69 */ 70 70 void Volume::update() -
trunk/packages/vizservers/vtkvis/RpVtkDataSet.cpp
r2317 r2320 75 75 reader->ReadAllScalarsOn(); 76 76 reader->ReadAllVectorsOn(); 77 reader->ReadAllFieldsOn(); 77 78 return setData(reader); 78 79 } … … 98 99 reader->ReadAllScalarsOn(); 99 100 reader->ReadAllVectorsOn(); 101 reader->ReadAllFieldsOn(); 100 102 101 103 bool status = setData(reader); -
trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp
r2318 r2320 128 128 addColorMap("default", ColorMap::getDefault()); 129 129 addColorMap("volumeDefault", ColorMap::getVolumeDefault()); 130 addColorMap("elementDefault", ColorMap::getElementDefault()); 130 131 } 131 132 … … 157 158 } 158 159 _heightMaps.clear(); 160 TRACE("Deleting LICs"); 161 for (LICHashmap::iterator itr = _lics.begin(); 162 itr != _lics.end(); ++itr) { 163 delete itr->second; 164 } 165 _lics.clear(); 166 TRACE("Deleting Molecules"); 167 for (MoleculeHashmap::iterator itr = _molecules.begin(); 168 itr != _molecules.end(); ++itr) { 169 delete itr->second; 170 } 171 _molecules.clear(); 159 172 TRACE("Deleting PolyDatas"); 160 173 for (PolyDataHashmap::iterator itr = _polyDatas.begin(); … … 208 221 { 209 222 if (getDataSet(id) != NULL) { 210 WARN("Replacing existing dataset %s", id.c_str());223 WARN("Replacing existing DataSet %s", id.c_str()); 211 224 deleteDataSet(id); 212 225 } … … 354 367 itr = _heightMaps.erase(itr); 355 368 } while (doAll && itr != _heightMaps.end()); 369 370 _needsRedraw = true; 371 } 372 373 /** 374 * \brief Remove the LIC for the specified DataSet 375 * 376 * The underlying LIC is deleted, freeing its memory 377 */ 378 void Renderer::deleteLIC(const DataSetId& id) 379 { 380 LICHashmap::iterator itr; 381 382 bool doAll = false; 383 384 if (id.compare("all") == 0) { 385 itr = _lics.begin(); 386 doAll = true; 387 } else { 388 itr = _lics.find(id); 389 } 390 if (itr == _lics.end()) { 391 ERROR("LIC not found: %s", id.c_str()); 392 return; 393 } 394 395 TRACE("Deleting LICs for %s", id.c_str()); 396 397 do { 398 LIC *lic = itr->second; 399 if (lic->getProp()) 400 _renderer->RemoveViewProp(lic->getProp()); 401 delete lic; 402 403 itr = _lics.erase(itr); 404 } while (doAll && itr != _lics.end()); 405 406 _needsRedraw = true; 407 } 408 409 /** 410 * \brief Remove the Molecule for the specified DataSet 411 * 412 * The underlying Molecule is deleted, freeing its memory 413 */ 414 void Renderer::deleteMolecule(const DataSetId& id) 415 { 416 MoleculeHashmap::iterator itr; 417 418 bool doAll = false; 419 420 if (id.compare("all") == 0) { 421 itr = _molecules.begin(); 422 doAll = true; 423 } else { 424 itr = _molecules.find(id); 425 } 426 if (itr == _molecules.end()) { 427 ERROR("Molecule not found: %s", id.c_str()); 428 return; 429 } 430 431 TRACE("Deleting Molecules for %s", id.c_str()); 432 433 do { 434 Molecule *molecule = itr->second; 435 if (molecule->getProp()) 436 _renderer->RemoveViewProp(molecule->getProp()); 437 delete molecule; 438 439 itr = _molecules.erase(itr); 440 } while (doAll && itr != _molecules.end()); 356 441 357 442 _needsRedraw = true; … … 532 617 deleteGlyphs(itr->second->getName()); 533 618 deleteHeightMap(itr->second->getName()); 619 deleteLIC(itr->second->getName()); 620 deleteMolecule(itr->second->getName()); 534 621 deletePolyData(itr->second->getName()); 535 622 deletePseudoColor(itr->second->getName()); … … 898 985 colorMap->build(); 899 986 if (getColorMap(id) != NULL) { 900 WARN("Replacing existing colormap %s", id.c_str());987 WARN("Replacing existing ColorMap %s", id.c_str()); 901 988 deleteColorMap(id); 902 989 } … … 1085 1172 1086 1173 if (getContour2D(dsID)) { 1087 WARN("Replacing existing contour2d%s", dsID.c_str());1174 WARN("Replacing existing Contour2D %s", dsID.c_str()); 1088 1175 deleteContour2D(dsID); 1089 1176 } … … 1334 1421 1335 1422 if (getContour3D(dsID)) { 1336 WARN("Replacing existing contour3d%s", dsID.c_str());1423 WARN("Replacing existing Contour3D %s", dsID.c_str()); 1337 1424 deleteContour3D(dsID); 1338 1425 } … … 2461 2548 2462 2549 /** 2463 * \brief Create a new PolyDataand associate it with the named DataSet2464 */ 2465 void Renderer::add PolyData(const DataSetId& id)2550 * \brief Create a new LIC and associate it with the named DataSet 2551 */ 2552 void Renderer::addLIC(const DataSetId& id) 2466 2553 { 2467 2554 DataSetHashmap::iterator itr; … … 2483 2570 const DataSetId& dsID = ds->getName(); 2484 2571 2572 if (getLIC(dsID)) { 2573 WARN("Replacing existing LIC %s", dsID.c_str()); 2574 deleteLIC(dsID); 2575 } 2576 2577 LIC *lic = new LIC(); 2578 _lics[dsID] = lic; 2579 2580 lic->setDataSet(ds); 2581 2582 _renderer->AddViewProp(lic->getProp()); 2583 } while (doAll && ++itr != _dataSets.end()); 2584 2585 if (_cameraMode == IMAGE) 2586 setCameraMode(PERSPECTIVE); 2587 initCamera(); 2588 _needsRedraw = true; 2589 } 2590 2591 /** 2592 * \brief Get the LIC associated with a named DataSet 2593 */ 2594 LIC *Renderer::getLIC(const DataSetId& id) 2595 { 2596 LICHashmap::iterator itr = _lics.find(id); 2597 2598 if (itr == _lics.end()) { 2599 TRACE("LIC not found: %s", id.c_str()); 2600 return NULL; 2601 } else 2602 return itr->second; 2603 } 2604 2605 /** 2606 * \brief Set the volume slice used for mapping volumetric data 2607 */ 2608 void Renderer::setLICVolumeSlice(const DataSetId& id, LIC::Axis axis, double ratio) 2609 { 2610 LICHashmap::iterator itr; 2611 2612 bool doAll = false; 2613 2614 if (id.compare("all") == 0) { 2615 itr = _lics.begin(); 2616 doAll = true; 2617 } else { 2618 itr = _lics.find(id); 2619 } 2620 2621 if (itr == _lics.end()) { 2622 ERROR("LIC not found: %s", id.c_str()); 2623 return; 2624 } 2625 2626 do { 2627 itr->second->selectVolumeSlice(axis, ratio); 2628 } while (doAll && ++itr != _lics.end()); 2629 2630 initCamera(); 2631 _needsRedraw = true; 2632 } 2633 2634 /** 2635 * \brief Associate an existing named color map with an LIC for the given DataSet 2636 */ 2637 void Renderer::setLICColorMap(const DataSetId& id, const ColorMapId& colorMapId) 2638 { 2639 LICHashmap::iterator itr; 2640 2641 bool doAll = false; 2642 2643 if (id.compare("all") == 0) { 2644 itr = _lics.begin(); 2645 doAll = true; 2646 } else { 2647 itr = _lics.find(id); 2648 } 2649 2650 if (itr == _lics.end()) { 2651 ERROR("LIC not found: %s", id.c_str()); 2652 return; 2653 } 2654 2655 ColorMap *cmap = getColorMap(colorMapId); 2656 if (cmap == NULL) { 2657 ERROR("Unknown colormap: %s", colorMapId.c_str()); 2658 return; 2659 } 2660 2661 do { 2662 TRACE("Set LIC color map: %s for dataset %s", colorMapId.c_str(), 2663 itr->second->getDataSet()->getName().c_str()); 2664 2665 // Make a copy of the generic colormap lookup table, so 2666 // data range can be set in the copy table to match the 2667 // dataset being plotted 2668 vtkSmartPointer<vtkLookupTable> lut = vtkSmartPointer<vtkLookupTable>::New(); 2669 lut->DeepCopy(cmap->getLookupTable()); 2670 2671 if (_useCumulativeRange) { 2672 lut->SetRange(_cumulativeDataRange); 2673 } else { 2674 if (itr->second->getDataSet() != NULL) { 2675 double range[2]; 2676 itr->second->getDataSet()->getDataRange(range); 2677 lut->SetRange(range); 2678 } 2679 } 2680 2681 itr->second->setLookupTable(lut); 2682 } while (doAll && ++itr != _lics.end()); 2683 2684 _needsRedraw = true; 2685 } 2686 2687 /** 2688 * \brief Set opacity of the LIC for the given DataSet 2689 */ 2690 void Renderer::setLICOpacity(const DataSetId& id, double opacity) 2691 { 2692 LICHashmap::iterator itr; 2693 2694 bool doAll = false; 2695 2696 if (id.compare("all") == 0) { 2697 itr = _lics.begin(); 2698 doAll = true; 2699 } else { 2700 itr = _lics.find(id); 2701 } 2702 if (itr == _lics.end()) { 2703 ERROR("LIC not found: %s", id.c_str()); 2704 return; 2705 } 2706 2707 do { 2708 itr->second->setOpacity(opacity); 2709 } while (doAll && ++itr != _lics.end()); 2710 2711 _needsRedraw = true; 2712 } 2713 2714 /** 2715 * \brief Turn on/off rendering of the LIC for the given DataSet 2716 */ 2717 void Renderer::setLICVisibility(const DataSetId& id, bool state) 2718 { 2719 LICHashmap::iterator itr; 2720 2721 bool doAll = false; 2722 2723 if (id.compare("all") == 0) { 2724 itr = _lics.begin(); 2725 doAll = true; 2726 } else { 2727 itr = _lics.find(id); 2728 } 2729 if (itr == _lics.end()) { 2730 ERROR("LIC not found: %s", id.c_str()); 2731 return; 2732 } 2733 2734 do { 2735 itr->second->setVisibility(state); 2736 } while (doAll && ++itr != _lics.end()); 2737 2738 _needsRedraw = true; 2739 } 2740 2741 /** 2742 * \brief Set the visibility of polygon edges for the specified DataSet 2743 */ 2744 void Renderer::setLICEdgeVisibility(const DataSetId& id, bool state) 2745 { 2746 LICHashmap::iterator itr; 2747 2748 bool doAll = false; 2749 2750 if (id.compare("all") == 0) { 2751 itr = _lics.begin(); 2752 doAll = true; 2753 } else { 2754 itr = _lics.find(id); 2755 } 2756 if (itr == _lics.end()) { 2757 ERROR("LIC not found: %s", id.c_str()); 2758 return; 2759 } 2760 2761 do { 2762 itr->second->setEdgeVisibility(state); 2763 } while (doAll && ++itr != _lics.end()); 2764 2765 _needsRedraw = true; 2766 } 2767 2768 /** 2769 * \brief Set the RGB polygon edge color for the specified DataSet 2770 */ 2771 void Renderer::setLICEdgeColor(const DataSetId& id, float color[3]) 2772 { 2773 LICHashmap::iterator itr; 2774 2775 bool doAll = false; 2776 2777 if (id.compare("all") == 0) { 2778 itr = _lics.begin(); 2779 doAll = true; 2780 } else { 2781 itr = _lics.find(id); 2782 } 2783 if (itr == _lics.end()) { 2784 ERROR("LIC not found: %s", id.c_str()); 2785 return; 2786 } 2787 2788 do { 2789 itr->second->setEdgeColor(color); 2790 } while (doAll && ++itr != _lics.end()); 2791 2792 _needsRedraw = true; 2793 } 2794 2795 /** 2796 * \brief Set the polygon edge width for the specified DataSet (may be a no-op) 2797 * 2798 * If the OpenGL implementation/hardware does not support wide lines, 2799 * this function may not have an effect. 2800 */ 2801 void Renderer::setLICEdgeWidth(const DataSetId& id, float edgeWidth) 2802 { 2803 LICHashmap::iterator itr; 2804 2805 bool doAll = false; 2806 2807 if (id.compare("all") == 0) { 2808 itr = _lics.begin(); 2809 doAll = true; 2810 } else { 2811 itr = _lics.find(id); 2812 } 2813 if (itr == _lics.end()) { 2814 ERROR("LIC not found: %s", id.c_str()); 2815 return; 2816 } 2817 2818 do { 2819 itr->second->setEdgeWidth(edgeWidth); 2820 } while (doAll && ++itr != _lics.end()); 2821 2822 _needsRedraw = true; 2823 } 2824 2825 /** 2826 * \brief Turn LIC lighting on/off for the specified DataSet 2827 */ 2828 void Renderer::setLICLighting(const DataSetId& id, bool state) 2829 { 2830 LICHashmap::iterator itr; 2831 2832 bool doAll = false; 2833 2834 if (id.compare("all") == 0) { 2835 itr = _lics.begin(); 2836 doAll = true; 2837 } else { 2838 itr = _lics.find(id); 2839 } 2840 if (itr == _lics.end()) { 2841 ERROR("LIC not found: %s", id.c_str()); 2842 return; 2843 } 2844 2845 do { 2846 itr->second->setLighting(state); 2847 } while (doAll && ++itr != _lics.end()); 2848 2849 _needsRedraw = true; 2850 } 2851 2852 /** 2853 * \brief Create a new Molecule and associate it with the named DataSet 2854 */ 2855 void Renderer::addMolecule(const DataSetId& id) 2856 { 2857 DataSetHashmap::iterator itr; 2858 2859 bool doAll = false; 2860 2861 if (id.compare("all") == 0) { 2862 itr = _dataSets.begin(); 2863 } else { 2864 itr = _dataSets.find(id); 2865 } 2866 if (itr == _dataSets.end()) { 2867 ERROR("Unknown dataset %s", id.c_str()); 2868 return; 2869 } 2870 2871 do { 2872 DataSet *ds = itr->second; 2873 const DataSetId& dsID = ds->getName(); 2874 2875 if (getMolecule(dsID)) { 2876 WARN("Replacing existing Molecule %s", dsID.c_str()); 2877 deleteMolecule(dsID); 2878 } 2879 2880 Molecule *molecule = new Molecule(); 2881 _molecules[dsID] = molecule; 2882 2883 molecule->setDataSet(ds); 2884 2885 _renderer->AddViewProp(molecule->getProp()); 2886 } while (doAll && ++itr != _dataSets.end()); 2887 2888 if (_cameraMode == IMAGE) 2889 setCameraMode(PERSPECTIVE); 2890 initCamera(); 2891 _needsRedraw = true; 2892 } 2893 2894 /** 2895 * \brief Get the Molecule associated with a named DataSet 2896 */ 2897 Molecule *Renderer::getMolecule(const DataSetId& id) 2898 { 2899 MoleculeHashmap::iterator itr = _molecules.find(id); 2900 2901 if (itr == _molecules.end()) { 2902 TRACE("Molecule not found: %s", id.c_str()); 2903 return NULL; 2904 } else 2905 return itr->second; 2906 } 2907 2908 /** 2909 * \brief Associate an existing named color map with a Molecule for the given DataSet 2910 */ 2911 void Renderer::setMoleculeColorMap(const DataSetId& id, const ColorMapId& colorMapId) 2912 { 2913 MoleculeHashmap::iterator itr; 2914 2915 bool doAll = false; 2916 2917 if (id.compare("all") == 0) { 2918 itr = _molecules.begin(); 2919 doAll = true; 2920 } else { 2921 itr = _molecules.find(id); 2922 } 2923 2924 if (itr == _molecules.end()) { 2925 ERROR("Molecule not found: %s", id.c_str()); 2926 return; 2927 } 2928 2929 ColorMap *cmap = getColorMap(colorMapId); 2930 if (cmap == NULL) { 2931 ERROR("Unknown colormap: %s", colorMapId.c_str()); 2932 return; 2933 } 2934 2935 do { 2936 TRACE("Set Molecule color map: %s for dataset %s", colorMapId.c_str(), 2937 itr->second->getDataSet()->getName().c_str()); 2938 2939 // Make a copy of the generic colormap lookup table, so 2940 // data range can be set in the copy table to match the 2941 // dataset being plotted 2942 vtkSmartPointer<vtkLookupTable> lut = vtkSmartPointer<vtkLookupTable>::New(); 2943 lut->DeepCopy(cmap->getLookupTable()); 2944 2945 if (_useCumulativeRange) { 2946 lut->SetRange(_cumulativeDataRange); 2947 } else { 2948 if (itr->second->getDataSet() != NULL) { 2949 double range[2]; 2950 itr->second->getDataSet()->getDataRange(range); 2951 lut->SetRange(range); 2952 } 2953 } 2954 2955 itr->second->setLookupTable(lut); 2956 } while (doAll && ++itr != _molecules.end()); 2957 2958 _needsRedraw = true; 2959 } 2960 2961 /** 2962 * \brief Set opacity of the Molecule for the given DataSet 2963 */ 2964 void Renderer::setMoleculeOpacity(const DataSetId& id, double opacity) 2965 { 2966 MoleculeHashmap::iterator itr; 2967 2968 bool doAll = false; 2969 2970 if (id.compare("all") == 0) { 2971 itr = _molecules.begin(); 2972 doAll = true; 2973 } else { 2974 itr = _molecules.find(id); 2975 } 2976 if (itr == _molecules.end()) { 2977 ERROR("Molecule not found: %s", id.c_str()); 2978 return; 2979 } 2980 2981 do { 2982 itr->second->setOpacity(opacity); 2983 } while (doAll && ++itr != _molecules.end()); 2984 2985 _needsRedraw = true; 2986 } 2987 2988 /** 2989 * \brief Set radius standard for scaling atoms 2990 */ 2991 void Renderer::setMoleculeAtomScaling(const DataSetId& id, Molecule::AtomScaling scaling) 2992 { 2993 MoleculeHashmap::iterator itr; 2994 2995 bool doAll = false; 2996 2997 if (id.compare("all") == 0) { 2998 itr = _molecules.begin(); 2999 doAll = true; 3000 } else { 3001 itr = _molecules.find(id); 3002 } 3003 if (itr == _molecules.end()) { 3004 ERROR("Molecule not found: %s", id.c_str()); 3005 return; 3006 } 3007 3008 do { 3009 itr->second->setAtomScaling(scaling); 3010 } while (doAll && ++itr != _molecules.end()); 3011 3012 _needsRedraw = true; 3013 } 3014 3015 /** 3016 * \brief Turn on/off rendering of the Molecule atoms for the given DataSet 3017 */ 3018 void Renderer::setMoleculeAtomVisibility(const DataSetId& id, bool state) 3019 { 3020 MoleculeHashmap::iterator itr; 3021 3022 bool doAll = false; 3023 3024 if (id.compare("all") == 0) { 3025 itr = _molecules.begin(); 3026 doAll = true; 3027 } else { 3028 itr = _molecules.find(id); 3029 } 3030 if (itr == _molecules.end()) { 3031 ERROR("Molecule not found: %s", id.c_str()); 3032 return; 3033 } 3034 3035 do { 3036 itr->second->setAtomVisibility(state); 3037 } while (doAll && ++itr != _molecules.end()); 3038 3039 _needsRedraw = true; 3040 } 3041 3042 /** 3043 * \brief Turn on/off rendering of the Molecule bonds for the given DataSet 3044 */ 3045 void Renderer::setMoleculeBondVisibility(const DataSetId& id, bool state) 3046 { 3047 MoleculeHashmap::iterator itr; 3048 3049 bool doAll = false; 3050 3051 if (id.compare("all") == 0) { 3052 itr = _molecules.begin(); 3053 doAll = true; 3054 } else { 3055 itr = _molecules.find(id); 3056 } 3057 if (itr == _molecules.end()) { 3058 ERROR("Molecule not found: %s", id.c_str()); 3059 return; 3060 } 3061 3062 do { 3063 itr->second->setBondVisibility(state); 3064 } while (doAll && ++itr != _molecules.end()); 3065 3066 _needsRedraw = true; 3067 } 3068 3069 /** 3070 * \brief Turn on/off rendering of the Molecule for the given DataSet 3071 */ 3072 void Renderer::setMoleculeVisibility(const DataSetId& id, bool state) 3073 { 3074 MoleculeHashmap::iterator itr; 3075 3076 bool doAll = false; 3077 3078 if (id.compare("all") == 0) { 3079 itr = _molecules.begin(); 3080 doAll = true; 3081 } else { 3082 itr = _molecules.find(id); 3083 } 3084 if (itr == _molecules.end()) { 3085 ERROR("Molecule not found: %s", id.c_str()); 3086 return; 3087 } 3088 3089 do { 3090 itr->second->setVisibility(state); 3091 } while (doAll && ++itr != _molecules.end()); 3092 3093 _needsRedraw = true; 3094 } 3095 3096 /** 3097 * \brief Set the visibility of polygon edges for the specified DataSet 3098 */ 3099 void Renderer::setMoleculeEdgeVisibility(const DataSetId& id, bool state) 3100 { 3101 MoleculeHashmap::iterator itr; 3102 3103 bool doAll = false; 3104 3105 if (id.compare("all") == 0) { 3106 itr = _molecules.begin(); 3107 doAll = true; 3108 } else { 3109 itr = _molecules.find(id); 3110 } 3111 if (itr == _molecules.end()) { 3112 ERROR("Molecule not found: %s", id.c_str()); 3113 return; 3114 } 3115 3116 do { 3117 itr->second->setEdgeVisibility(state); 3118 } while (doAll && ++itr != _molecules.end()); 3119 3120 _needsRedraw = true; 3121 } 3122 3123 /** 3124 * \brief Set the RGB polygon edge color for the specified DataSet 3125 */ 3126 void Renderer::setMoleculeEdgeColor(const DataSetId& id, float color[3]) 3127 { 3128 MoleculeHashmap::iterator itr; 3129 3130 bool doAll = false; 3131 3132 if (id.compare("all") == 0) { 3133 itr = _molecules.begin(); 3134 doAll = true; 3135 } else { 3136 itr = _molecules.find(id); 3137 } 3138 if (itr == _molecules.end()) { 3139 ERROR("Molecule not found: %s", id.c_str()); 3140 return; 3141 } 3142 3143 do { 3144 itr->second->setEdgeColor(color); 3145 } while (doAll && ++itr != _molecules.end()); 3146 3147 _needsRedraw = true; 3148 } 3149 3150 /** 3151 * \brief Set the polygon edge width for the specified DataSet (may be a no-op) 3152 * 3153 * If the OpenGL implementation/hardware does not support wide lines, 3154 * this function may not have an effect. 3155 */ 3156 void Renderer::setMoleculeEdgeWidth(const DataSetId& id, float edgeWidth) 3157 { 3158 MoleculeHashmap::iterator itr; 3159 3160 bool doAll = false; 3161 3162 if (id.compare("all") == 0) { 3163 itr = _molecules.begin(); 3164 doAll = true; 3165 } else { 3166 itr = _molecules.find(id); 3167 } 3168 if (itr == _molecules.end()) { 3169 ERROR("Molecule not found: %s", id.c_str()); 3170 return; 3171 } 3172 3173 do { 3174 itr->second->setEdgeWidth(edgeWidth); 3175 } while (doAll && ++itr != _molecules.end()); 3176 3177 _needsRedraw = true; 3178 } 3179 3180 /** 3181 * \brief Set wireframe rendering for the specified DataSet 3182 */ 3183 void Renderer::setMoleculeWireframe(const DataSetId& id, bool state) 3184 { 3185 MoleculeHashmap::iterator itr; 3186 3187 bool doAll = false; 3188 3189 if (id.compare("all") == 0) { 3190 itr = _molecules.begin(); 3191 doAll = true; 3192 } else { 3193 itr = _molecules.find(id); 3194 } 3195 if (itr == _molecules.end()) { 3196 ERROR("Molecule not found: %s", id.c_str()); 3197 return; 3198 } 3199 3200 do { 3201 itr->second->setWireframe(state); 3202 } while (doAll && ++itr != _molecules.end()); 3203 3204 _needsRedraw = true; 3205 } 3206 3207 /** 3208 * \brief Turn Molecule lighting on/off for the specified DataSet 3209 */ 3210 void Renderer::setMoleculeLighting(const DataSetId& id, bool state) 3211 { 3212 MoleculeHashmap::iterator itr; 3213 3214 bool doAll = false; 3215 3216 if (id.compare("all") == 0) { 3217 itr = _molecules.begin(); 3218 doAll = true; 3219 } else { 3220 itr = _molecules.find(id); 3221 } 3222 if (itr == _molecules.end()) { 3223 ERROR("Molecule not found: %s", id.c_str()); 3224 return; 3225 } 3226 3227 do { 3228 itr->second->setLighting(state); 3229 } while (doAll && ++itr != _molecules.end()); 3230 3231 _needsRedraw = true; 3232 } 3233 3234 /** 3235 * \brief Create a new PolyData and associate it with the named DataSet 3236 */ 3237 void Renderer::addPolyData(const DataSetId& id) 3238 { 3239 DataSetHashmap::iterator itr; 3240 3241 bool doAll = false; 3242 3243 if (id.compare("all") == 0) { 3244 itr = _dataSets.begin(); 3245 } else { 3246 itr = _dataSets.find(id); 3247 } 3248 if (itr == _dataSets.end()) { 3249 ERROR("Unknown dataset %s", id.c_str()); 3250 return; 3251 } 3252 3253 do { 3254 DataSet *ds = itr->second; 3255 const DataSetId& dsID = ds->getName(); 3256 2485 3257 if (getPolyData(dsID)) { 2486 WARN("Replacing existing polydata %s", dsID.c_str());3258 WARN("Replacing existing PolyData %s", dsID.c_str()); 2487 3259 deletePolyData(dsID); 2488 3260 } … … 2758 3530 2759 3531 if (getPseudoColor(dsID)) { 2760 WARN("Replacing existing pseudocolor %s", dsID.c_str());3532 WARN("Replacing existing PseudoColor %s", dsID.c_str()); 2761 3533 deletePseudoColor(dsID); 2762 3534 } … … 3615 4387 3616 4388 if (getVolume(dsID)) { 3617 WARN("Replacing existing volume %s", dsID.c_str());4389 WARN("Replacing existing Volume %s", dsID.c_str()); 3618 4390 deleteVolume(dsID); 3619 4391 } … … 3855 4627 } 3856 4628 4629 /** 4630 * \brief Set camera FOV based on render window height 4631 * 4632 * Computes a field-of-view angle based on some assumptions about 4633 * viewer's distance to screen and pixel density 4634 */ 3857 4635 void Renderer::setViewAngle(int height) 3858 4636 { 3859 4637 // Distance of eyes from screen in inches 3860 4638 double d = 20.0; 3861 // Assume 72 dpi screen4639 // Assume 72 ppi screen 3862 4640 double h = (double)height / 72.0; 3863 4641 … … 4220 4998 4221 4999 /** 4222 * \brief Change the FOV of the camera5000 * \brief Dolly camera or set orthographic scaling based on camera type 4223 5001 * 4224 5002 * \param[in] z Ratio to change zoom (greater than 1 is zoom in, less than 1 is zoom out) … … 4515 5293 mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds()); 4516 5294 } 5295 for (LICHashmap::iterator itr = _lics.begin(); 5296 itr != _lics.end(); ++itr) { 5297 if (!onlyVisible || itr->second->getVisibility()) 5298 mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds()); 5299 } 5300 for (MoleculeHashmap::iterator itr = _molecules.begin(); 5301 itr != _molecules.end(); ++itr) { 5302 if (!onlyVisible || itr->second->getVisibility()) 5303 mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds()); 5304 } 4517 5305 for (PolyDataHashmap::iterator itr = _polyDatas.begin(); 4518 5306 itr != _polyDatas.end(); ++itr) { … … 4617 5405 } else { 4618 5406 itr->second->setContours(itr->second->getNumContours()); 5407 } 5408 } 5409 } 5410 for (LICHashmap::iterator itr = _lics.begin(); 5411 itr != _lics.end(); ++itr) { 5412 vtkLookupTable *lut = itr->second->getLookupTable(); 5413 if (lut) { 5414 if (useCumulative) { 5415 lut->SetRange(_cumulativeDataRange); 5416 } else { 5417 double range[2]; 5418 if (itr->second->getDataSet()) { 5419 itr->second->getDataSet()->getDataRange(range); 5420 lut->SetRange(range); 5421 } 4619 5422 } 4620 5423 } … … 4796 5599 if (id.compare("all") == 0 || getHeightMap(id) != NULL) 4797 5600 setHeightMapOpacity(id, opacity); 5601 if (id.compare("all") == 0 || getLIC(id) != NULL) 5602 setLICOpacity(id, opacity); 5603 if (id.compare("all") == 0 || getMolecule(id) != NULL) 5604 setMoleculeOpacity(id, opacity); 4798 5605 if (id.compare("all") == 0 || getPolyData(id) != NULL) 4799 5606 setPolyDataOpacity(id, opacity); … … 4838 5645 if (id.compare("all") == 0 || getHeightMap(id) != NULL) 4839 5646 setHeightMapVisibility(id, state); 5647 if (id.compare("all") == 0 || getLIC(id) != NULL) 5648 setLICVisibility(id, state); 5649 if (id.compare("all") == 0 || getMolecule(id) != NULL) 5650 setMoleculeVisibility(id, state); 4840 5651 if (id.compare("all") == 0 || getPolyData(id) != NULL) 4841 5652 setPolyDataVisibility(id, state); … … 4993 5804 itr->second->setClippingPlanes(_activeClipPlanes); 4994 5805 } 5806 for (LICHashmap::iterator itr = _lics.begin(); 5807 itr != _lics.end(); ++itr) { 5808 itr->second->setClippingPlanes(_activeClipPlanes); 5809 } 5810 for (MoleculeHashmap::iterator itr = _molecules.begin(); 5811 itr != _molecules.end(); ++itr) { 5812 itr->second->setClippingPlanes(_activeClipPlanes); 5813 } 4995 5814 for (PolyDataHashmap::iterator itr = _polyDatas.begin(); 4996 5815 itr != _polyDatas.end(); ++itr) { -
trunk/packages/vizservers/vtkvis/RpVtkRenderer.h
r2318 r2320 31 31 #include "RpGlyphs.h" 32 32 #include "RpHeightMap.h" 33 #include "RpLIC.h" 34 #include "RpMolecule.h" 33 35 #include "RpPolyData.h" 34 36 #include "RpPseudoColor.h" … … 81 83 typedef std::tr1::unordered_map<DataSetId, Glyphs *> GlyphsHashmap; 82 84 typedef std::tr1::unordered_map<DataSetId, HeightMap *> HeightMapHashmap; 85 typedef std::tr1::unordered_map<DataSetId, LIC *> LICHashmap; 86 typedef std::tr1::unordered_map<DataSetId, Molecule *> MoleculeHashmap; 83 87 typedef std::tr1::unordered_map<DataSetId, PolyData *> PolyDataHashmap; 84 88 typedef std::tr1::unordered_map<DataSetId, PseudoColor *> PseudoColorHashmap; … … 109 113 110 114 // Render window 115 116 vtkRenderWindow *getRenderWindow() 117 { 118 return _renderWindow; 119 } 111 120 112 121 void setWindowSize(int width, int height); … … 302 311 void setHeightMapLighting(const DataSetId& id, bool state); 303 312 304 // Meshes 313 // LIC plots 314 315 void addLIC(const DataSetId& id); 316 317 void deleteLIC(const DataSetId& id); 318 319 LIC *getLIC(const DataSetId& id); 320 321 void setLICVolumeSlice(const DataSetId& id, LIC::Axis axis, double ratio); 322 323 void setLICColorMap(const DataSetId& id, const ColorMapId& colorMapId); 324 325 void setLICOpacity(const DataSetId& id, double opacity); 326 327 void setLICVisibility(const DataSetId& id, bool state); 328 329 void setLICEdgeVisibility(const DataSetId& id, bool state); 330 331 void setLICEdgeColor(const DataSetId& id, float color[3]); 332 333 void setLICEdgeWidth(const DataSetId& id, float edgeWidth); 334 335 void setLICLighting(const DataSetId& id, bool state); 336 337 // Molecules 338 339 void addMolecule(const DataSetId& id); 340 341 void deleteMolecule(const DataSetId& id); 342 343 Molecule *getMolecule(const DataSetId& id); 344 345 void setMoleculeColorMap(const DataSetId& id, const ColorMapId& colorMapId); 346 347 void setMoleculeOpacity(const DataSetId& id, double opacity); 348 349 void setMoleculeAtomScaling(const DataSetId& id, Molecule::AtomScaling scaling); 350 351 void setMoleculeAtomVisibility(const DataSetId& id, bool state); 352 353 void setMoleculeBondVisibility(const DataSetId& id, bool state); 354 355 void setMoleculeVisibility(const DataSetId& id, bool state); 356 357 void setMoleculeEdgeVisibility(const DataSetId& id, bool state); 358 359 void setMoleculeEdgeColor(const DataSetId& id, float color[3]); 360 361 void setMoleculeEdgeWidth(const DataSetId& id, float edgeWidth); 362 363 void setMoleculeWireframe(const DataSetId& id, bool state); 364 365 void setMoleculeLighting(const DataSetId& id, bool state); 366 367 // PolyData Meshes 305 368 306 369 void addPolyData(const DataSetId& id); … … 465 528 GlyphsHashmap _glyphs; 466 529 HeightMapHashmap _heightMaps; 530 LICHashmap _lics; 531 MoleculeHashmap _molecules; 467 532 PolyDataHashmap _polyDatas; 468 533 PseudoColorHashmap _pseudoColors; -
trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp
r2318 r2320 1798 1798 1799 1799 static int 1800 LICAddOp(ClientData clientData, Tcl_Interp *interp, int objc, 1801 Tcl_Obj *const *objv) 1802 { 1803 if (objc == 3) { 1804 const char *name = Tcl_GetString(objv[2]); 1805 g_renderer->addLIC(name); 1806 } else { 1807 g_renderer->addLIC("all"); 1808 } 1809 return TCL_OK; 1810 } 1811 1812 static int 1813 LICColorMapOp(ClientData clientData, Tcl_Interp *interp, int objc, 1814 Tcl_Obj *const *objv) 1815 { 1816 const char *colorMapName = Tcl_GetString(objv[2]); 1817 if (objc == 4) { 1818 const char *dataSetName = Tcl_GetString(objv[3]); 1819 g_renderer->setLICColorMap(dataSetName, colorMapName); 1820 } else { 1821 g_renderer->setLICColorMap("all", colorMapName); 1822 } 1823 return TCL_OK; 1824 } 1825 1826 static int 1827 LICDeleteOp(ClientData clientData, Tcl_Interp *interp, int objc, 1828 Tcl_Obj *const *objv) 1829 { 1830 if (objc == 3) { 1831 const char *name = Tcl_GetString(objv[2]); 1832 g_renderer->deleteLIC(name); 1833 } else { 1834 g_renderer->deleteLIC("all"); 1835 } 1836 return TCL_OK; 1837 } 1838 1839 static int 1840 LICEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc, 1841 Tcl_Obj *const *objv) 1842 { 1843 bool state; 1844 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 1845 return TCL_ERROR; 1846 } 1847 if (objc == 4) { 1848 const char *name = Tcl_GetString(objv[3]); 1849 g_renderer->setLICEdgeVisibility(name, state); 1850 } else { 1851 g_renderer->setLICEdgeVisibility("all", state); 1852 } 1853 return TCL_OK; 1854 } 1855 1856 static int 1857 LICLightingOp(ClientData clientData, Tcl_Interp *interp, int objc, 1858 Tcl_Obj *const *objv) 1859 { 1860 bool state; 1861 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 1862 return TCL_ERROR; 1863 } 1864 if (objc == 4) { 1865 const char *name = Tcl_GetString(objv[3]); 1866 g_renderer->setLICLighting(name, state); 1867 } else { 1868 g_renderer->setLICLighting("all", state); 1869 } 1870 return TCL_OK; 1871 } 1872 1873 static int 1874 LICLineColorOp(ClientData clientData, Tcl_Interp *interp, int objc, 1875 Tcl_Obj *const *objv) 1876 { 1877 float color[3]; 1878 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK || 1879 GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK || 1880 GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) { 1881 return TCL_ERROR; 1882 } 1883 if (objc == 6) { 1884 const char *name = Tcl_GetString(objv[5]); 1885 g_renderer->setLICEdgeColor(name, color); 1886 } else { 1887 g_renderer->setLICEdgeColor("all", color); 1888 } 1889 return TCL_OK; 1890 } 1891 1892 static int 1893 LICLineWidthOp(ClientData clientData, Tcl_Interp *interp, int objc, 1894 Tcl_Obj *const *objv) 1895 { 1896 float width; 1897 if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) { 1898 return TCL_ERROR; 1899 } 1900 if (objc == 4) { 1901 const char *name = Tcl_GetString(objv[3]); 1902 g_renderer->setLICEdgeWidth(name, width); 1903 } else { 1904 g_renderer->setLICEdgeWidth("all", width); 1905 } 1906 return TCL_OK; 1907 } 1908 1909 static int 1910 LICOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc, 1911 Tcl_Obj *const *objv) 1912 { 1913 double opacity; 1914 if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) { 1915 return TCL_ERROR; 1916 } 1917 if (objc == 4) { 1918 const char *name = Tcl_GetString(objv[3]); 1919 g_renderer->setLICOpacity(name, opacity); 1920 } else { 1921 g_renderer->setLICOpacity("all", opacity); 1922 } 1923 return TCL_OK; 1924 } 1925 1926 static int 1927 LICVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc, 1928 Tcl_Obj *const *objv) 1929 { 1930 bool state; 1931 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 1932 return TCL_ERROR; 1933 } 1934 if (objc == 4) { 1935 const char *name = Tcl_GetString(objv[3]); 1936 g_renderer->setLICVisibility(name, state); 1937 } else { 1938 g_renderer->setLICVisibility("all", state); 1939 } 1940 return TCL_OK; 1941 } 1942 1943 static int 1944 LICVolumeSliceOp(ClientData clientData, Tcl_Interp *interp, int objc, 1945 Tcl_Obj *const *objv) 1946 { 1947 double ratio; 1948 if (Tcl_GetDoubleFromObj(interp, objv[3], &ratio) != TCL_OK) { 1949 return TCL_ERROR; 1950 } 1951 const char *string = Tcl_GetString(objv[2]); 1952 char c = string[0]; 1953 LIC::Axis axis; 1954 if ((c == 'x') && (strcmp(string, "x") == 0)) { 1955 axis = LIC::X_AXIS; 1956 } else if ((c == 'y') && (strcmp(string, "y") == 0)) { 1957 axis = LIC::Y_AXIS; 1958 } else if ((c == 'z') && (strcmp(string, "z") == 0)) { 1959 axis = LIC::Z_AXIS; 1960 } else { 1961 Tcl_AppendResult(interp, "bad axis option \"", string, 1962 "\": should be axisName ratio", (char*)NULL); 1963 return TCL_ERROR; 1964 } 1965 if (objc == 5) { 1966 const char *name = Tcl_GetString(objv[4]); 1967 g_renderer->setLICVolumeSlice(name, axis, ratio); 1968 } else { 1969 g_renderer->setLICVolumeSlice("all", axis, ratio); 1970 } 1971 return TCL_OK; 1972 } 1973 1974 static Rappture::CmdSpec licOps[] = { 1975 {"add", 1, LICAddOp, 2, 3, "?dataSetName?"}, 1976 {"colormap", 1, LICColorMapOp, 3, 4, "colorMapName ?dataSetName?"}, 1977 {"delete", 1, LICDeleteOp, 2, 3, "?dataSetName?"}, 1978 {"edges", 1, LICEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"}, 1979 {"lighting", 3, LICLightingOp, 3, 4, "bool ?dataSetName?"}, 1980 {"linecolor", 5, LICLineColorOp, 5, 6, "r g b ?dataSetName?"}, 1981 {"linewidth", 5, LICLineWidthOp, 3, 4, "width ?dataSetName?"}, 1982 {"opacity", 1, LICOpacityOp, 3, 4, "value ?dataSetName?"}, 1983 {"visible", 2, LICVisibleOp, 3, 4, "bool ?dataSetName?"}, 1984 {"volumeslice", 2, LICVolumeSliceOp, 4, 5, "axis ratio ?dataSetName?"} 1985 }; 1986 static int nLICOps = NumCmdSpecs(licOps); 1987 1988 static int 1989 LICCmd(ClientData clientData, Tcl_Interp *interp, int objc, 1990 Tcl_Obj *const *objv) 1991 { 1992 Tcl_ObjCmdProc *proc; 1993 1994 proc = Rappture::GetOpFromObj(interp, nLICOps, licOps, 1995 Rappture::CMDSPEC_ARG1, objc, objv, 0); 1996 if (proc == NULL) { 1997 return TCL_ERROR; 1998 } 1999 return (*proc) (clientData, interp, objc, objv); 2000 } 2001 2002 static int 2003 MoleculeAddOp(ClientData clientData, Tcl_Interp *interp, int objc, 2004 Tcl_Obj *const *objv) 2005 { 2006 if (objc == 3) { 2007 const char *name = Tcl_GetString(objv[2]); 2008 g_renderer->addMolecule(name); 2009 } else { 2010 g_renderer->addMolecule("all"); 2011 } 2012 return TCL_OK; 2013 } 2014 2015 static int 2016 MoleculeAtomVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc, 2017 Tcl_Obj *const *objv) 2018 { 2019 bool state; 2020 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 2021 return TCL_ERROR; 2022 } 2023 if (objc == 4) { 2024 const char *name = Tcl_GetString(objv[3]); 2025 g_renderer->setMoleculeAtomVisibility(name, state); 2026 } else { 2027 g_renderer->setMoleculeAtomVisibility("all", state); 2028 } 2029 return TCL_OK; 2030 } 2031 2032 static int 2033 MoleculeAtomScalingOp(ClientData clientData, Tcl_Interp *interp, int objc, 2034 Tcl_Obj *const *objv) 2035 { 2036 Molecule::AtomScaling scaling; 2037 const char *scalingOpt = Tcl_GetString(objv[2]); 2038 if (scalingOpt[0] == 'v' && strcmp(scalingOpt, "van_der_waals") == 0) { 2039 scaling = Molecule::VAN_DER_WAALS_RADIUS; 2040 } else if (scalingOpt[0] == 'c' && strcmp(scalingOpt, "covalent") == 0) { 2041 scaling = Molecule::COVALENT_RADIUS; 2042 } else if (scalingOpt[0] == 'a' && strcmp(scalingOpt, "atomic") == 0) { 2043 scaling = Molecule::ATOMIC_RADIUS; 2044 } else if (scalingOpt[0] == 'n' && strcmp(scalingOpt, "none") == 0) { 2045 scaling = Molecule::NO_ATOM_SCALING; 2046 } else { 2047 Tcl_AppendResult(interp, "bad atomscale option \"", scalingOpt, 2048 "\": should be van_der_waals, covalent, atomic, or none", (char*)NULL); 2049 return TCL_ERROR; 2050 } 2051 if (objc == 4) { 2052 const char *name = Tcl_GetString(objv[3]); 2053 g_renderer->setMoleculeAtomScaling(name, scaling); 2054 } else { 2055 g_renderer->setMoleculeAtomScaling("all", scaling); 2056 } 2057 return TCL_OK; 2058 } 2059 2060 static int 2061 MoleculeBondVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc, 2062 Tcl_Obj *const *objv) 2063 { 2064 bool state; 2065 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 2066 return TCL_ERROR; 2067 } 2068 if (objc == 4) { 2069 const char *name = Tcl_GetString(objv[3]); 2070 g_renderer->setMoleculeBondVisibility(name, state); 2071 } else { 2072 g_renderer->setMoleculeBondVisibility("all", state); 2073 } 2074 return TCL_OK; 2075 } 2076 2077 static int 2078 MoleculeColorMapOp(ClientData clientData, Tcl_Interp *interp, int objc, 2079 Tcl_Obj *const *objv) 2080 { 2081 const char *colorMapName = Tcl_GetString(objv[2]); 2082 if (objc == 4) { 2083 const char *dataSetName = Tcl_GetString(objv[3]); 2084 g_renderer->setMoleculeColorMap(dataSetName, colorMapName); 2085 } else { 2086 g_renderer->setMoleculeColorMap("all", colorMapName); 2087 } 2088 return TCL_OK; 2089 } 2090 2091 static int 2092 MoleculeDeleteOp(ClientData clientData, Tcl_Interp *interp, int objc, 2093 Tcl_Obj *const *objv) 2094 { 2095 if (objc == 3) { 2096 const char *name = Tcl_GetString(objv[2]); 2097 g_renderer->deleteMolecule(name); 2098 } else { 2099 g_renderer->deleteMolecule("all"); 2100 } 2101 return TCL_OK; 2102 } 2103 2104 static int 2105 MoleculeEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc, 2106 Tcl_Obj *const *objv) 2107 { 2108 bool state; 2109 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 2110 return TCL_ERROR; 2111 } 2112 if (objc == 4) { 2113 const char *name = Tcl_GetString(objv[3]); 2114 g_renderer->setMoleculeEdgeVisibility(name, state); 2115 } else { 2116 g_renderer->setMoleculeEdgeVisibility("all", state); 2117 } 2118 return TCL_OK; 2119 } 2120 2121 static int 2122 MoleculeLightingOp(ClientData clientData, Tcl_Interp *interp, int objc, 2123 Tcl_Obj *const *objv) 2124 { 2125 bool state; 2126 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 2127 return TCL_ERROR; 2128 } 2129 if (objc == 4) { 2130 const char *name = Tcl_GetString(objv[3]); 2131 g_renderer->setMoleculeLighting(name, state); 2132 } else { 2133 g_renderer->setMoleculeLighting("all", state); 2134 } 2135 return TCL_OK; 2136 } 2137 2138 static int 2139 MoleculeLineColorOp(ClientData clientData, Tcl_Interp *interp, int objc, 2140 Tcl_Obj *const *objv) 2141 { 2142 float color[3]; 2143 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK || 2144 GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK || 2145 GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) { 2146 return TCL_ERROR; 2147 } 2148 if (objc == 6) { 2149 const char *name = Tcl_GetString(objv[5]); 2150 g_renderer->setMoleculeEdgeColor(name, color); 2151 } else { 2152 g_renderer->setMoleculeEdgeColor("all", color); 2153 } 2154 return TCL_OK; 2155 } 2156 2157 static int 2158 MoleculeLineWidthOp(ClientData clientData, Tcl_Interp *interp, int objc, 2159 Tcl_Obj *const *objv) 2160 { 2161 float width; 2162 if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) { 2163 return TCL_ERROR; 2164 } 2165 if (objc == 4) { 2166 const char *name = Tcl_GetString(objv[3]); 2167 g_renderer->setMoleculeEdgeWidth(name, width); 2168 } else { 2169 g_renderer->setMoleculeEdgeWidth("all", width); 2170 } 2171 return TCL_OK; 2172 } 2173 2174 static int 2175 MoleculeOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc, 2176 Tcl_Obj *const *objv) 2177 { 2178 double opacity; 2179 if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) { 2180 return TCL_ERROR; 2181 } 2182 if (objc == 4) { 2183 const char *name = Tcl_GetString(objv[3]); 2184 g_renderer->setMoleculeOpacity(name, opacity); 2185 } else { 2186 g_renderer->setMoleculeOpacity("all", opacity); 2187 } 2188 return TCL_OK; 2189 } 2190 2191 static int 2192 MoleculeVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc, 2193 Tcl_Obj *const *objv) 2194 { 2195 bool state; 2196 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 2197 return TCL_ERROR; 2198 } 2199 if (objc == 4) { 2200 const char *name = Tcl_GetString(objv[3]); 2201 g_renderer->setMoleculeVisibility(name, state); 2202 } else { 2203 g_renderer->setMoleculeVisibility("all", state); 2204 } 2205 return TCL_OK; 2206 } 2207 2208 static int 2209 MoleculeWireframeOp(ClientData clientData, Tcl_Interp *interp, int objc, 2210 Tcl_Obj *const *objv) 2211 { 2212 bool state; 2213 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 2214 return TCL_ERROR; 2215 } 2216 if (objc == 4) { 2217 const char *name = Tcl_GetString(objv[3]); 2218 g_renderer->setMoleculeWireframe(name, state); 2219 } else { 2220 g_renderer->setMoleculeWireframe("all", state); 2221 } 2222 return TCL_OK; 2223 } 2224 2225 static Rappture::CmdSpec moleculeOps[] = { 2226 {"add", 2, MoleculeAddOp, 2, 3, "?dataSetName?"}, 2227 {"atoms", 2, MoleculeAtomVisibilityOp, 3, 4, "bool ?dataSetName?"}, 2228 {"bonds", 2, MoleculeBondVisibilityOp, 3, 4, "bool ?dataSetName?"}, 2229 {"colormap", 1, MoleculeColorMapOp, 3, 4, "colorMapName ?dataSetName?"}, 2230 {"delete", 1, MoleculeDeleteOp, 2, 3, "?dataSetName?"}, 2231 {"edges", 1, MoleculeEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"}, 2232 {"lighting", 3, MoleculeLightingOp, 3, 4, "bool ?dataSetName?"}, 2233 {"linecolor", 5, MoleculeLineColorOp, 5, 6, "r g b ?dataSetName?"}, 2234 {"linewidth", 5, MoleculeLineWidthOp, 3, 4, "width ?dataSetName?"}, 2235 {"opacity", 1, MoleculeOpacityOp, 3, 4, "value ?dataSetName?"}, 2236 {"scaleatoms", 1, MoleculeAtomScalingOp, 3, 4, "scaling ?dataSetName?"}, 2237 {"visible", 1, MoleculeVisibleOp, 3, 4, "bool ?dataSetName?"}, 2238 {"wireframe", 1, MoleculeWireframeOp, 3, 4, "bool ?dataSetName?"} 2239 }; 2240 static int nMoleculeOps = NumCmdSpecs(moleculeOps); 2241 2242 static int 2243 MoleculeCmd(ClientData clientData, Tcl_Interp *interp, int objc, 2244 Tcl_Obj *const *objv) 2245 { 2246 Tcl_ObjCmdProc *proc; 2247 2248 proc = Rappture::GetOpFromObj(interp, nMoleculeOps, moleculeOps, 2249 Rappture::CMDSPEC_ARG1, objc, objv, 0); 2250 if (proc == NULL) { 2251 return TCL_ERROR; 2252 } 2253 return (*proc) (clientData, interp, objc, objv); 2254 } 2255 2256 static int 2257 PolyDataAddOp(ClientData clientData, Tcl_Interp *interp, int objc, 2258 Tcl_Obj *const *objv) 2259 { 2260 if (objc == 3) { 2261 const char *name = Tcl_GetString(objv[2]); 2262 g_renderer->addPolyData(name); 2263 } else { 2264 g_renderer->addPolyData("all"); 2265 } 2266 return TCL_OK; 2267 } 2268 2269 static int 2270 PolyDataDeleteOp(ClientData clientData, Tcl_Interp *interp, int objc, 2271 Tcl_Obj *const *objv) 2272 { 2273 if (objc == 3) { 2274 const char *name = Tcl_GetString(objv[2]); 2275 g_renderer->deletePolyData(name); 2276 } else { 2277 g_renderer->deletePolyData("all"); 2278 } 2279 return TCL_OK; 2280 } 2281 2282 static int 2283 PolyDataColorOp(ClientData clientData, Tcl_Interp *interp, int objc, 2284 Tcl_Obj *const *objv) 2285 { 2286 float color[3]; 2287 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK || 2288 GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK || 2289 GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) { 2290 return TCL_ERROR; 2291 } 2292 if (objc == 6) { 2293 const char *name = Tcl_GetString(objv[5]); 2294 g_renderer->setPolyDataColor(name, color); 2295 } else { 2296 g_renderer->setPolyDataColor("all", color); 2297 } 2298 return TCL_OK; 2299 } 2300 2301 static int 2302 PolyDataEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc, 2303 Tcl_Obj *const *objv) 2304 { 2305 bool state; 2306 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 2307 return TCL_ERROR; 2308 } 2309 if (objc == 4) { 2310 const char *name = Tcl_GetString(objv[3]); 2311 g_renderer->setPolyDataEdgeVisibility(name, state); 2312 } else { 2313 g_renderer->setPolyDataEdgeVisibility("all", state); 2314 } 2315 return TCL_OK; 2316 } 2317 2318 static int 2319 PolyDataLightingOp(ClientData clientData, Tcl_Interp *interp, int objc, 2320 Tcl_Obj *const *objv) 2321 { 2322 bool state; 2323 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 2324 return TCL_ERROR; 2325 } 2326 if (objc == 4) { 2327 const char *name = Tcl_GetString(objv[3]); 2328 g_renderer->setPolyDataLighting(name, state); 2329 } else { 2330 g_renderer->setPolyDataLighting("all", state); 2331 } 2332 return TCL_OK; 2333 } 2334 2335 static int 2336 PolyDataLineColorOp(ClientData clientData, Tcl_Interp *interp, int objc, 2337 Tcl_Obj *const *objv) 2338 { 2339 float color[3]; 2340 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK || 2341 GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK || 2342 GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) { 2343 return TCL_ERROR; 2344 } 2345 if (objc == 6) { 2346 const char *name = Tcl_GetString(objv[5]); 2347 g_renderer->setPolyDataEdgeColor(name, color); 2348 } else { 2349 g_renderer->setPolyDataEdgeColor("all", color); 2350 } 2351 return TCL_OK; 2352 } 2353 2354 static int 2355 PolyDataLineWidthOp(ClientData clientData, Tcl_Interp *interp, int objc, 2356 Tcl_Obj *const *objv) 2357 { 2358 float width; 2359 if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) { 2360 return TCL_ERROR; 2361 } 2362 if (objc == 4) { 2363 const char *name = Tcl_GetString(objv[3]); 2364 g_renderer->setPolyDataEdgeWidth(name, width); 2365 } else { 2366 g_renderer->setPolyDataEdgeWidth("all", width); 2367 } 2368 return TCL_OK; 2369 } 2370 2371 static int 2372 PolyDataOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc, 2373 Tcl_Obj *const *objv) 2374 { 2375 double opacity; 2376 if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) { 2377 return TCL_ERROR; 2378 } 2379 if (objc == 4) { 2380 const char *name = Tcl_GetString(objv[3]); 2381 g_renderer->setPolyDataOpacity(name, opacity); 2382 } else { 2383 g_renderer->setPolyDataOpacity("all", opacity); 2384 } 2385 return TCL_OK; 2386 } 2387 2388 static int 2389 PolyDataVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc, 2390 Tcl_Obj *const *objv) 2391 { 2392 bool state; 2393 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 2394 return TCL_ERROR; 2395 } 2396 if (objc == 4) { 2397 const char *name = Tcl_GetString(objv[3]); 2398 g_renderer->setPolyDataVisibility(name, state); 2399 } else { 2400 g_renderer->setPolyDataVisibility("all", state); 2401 } 2402 return TCL_OK; 2403 } 2404 2405 static int 2406 PolyDataWireframeOp(ClientData clientData, Tcl_Interp *interp, int objc, 2407 Tcl_Obj *const *objv) 2408 { 2409 bool state; 2410 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 2411 return TCL_ERROR; 2412 } 2413 if (objc == 4) { 2414 const char *name = Tcl_GetString(objv[3]); 2415 g_renderer->setPolyDataWireframe(name, state); 2416 } else { 2417 g_renderer->setPolyDataWireframe("all", state); 2418 } 2419 return TCL_OK; 2420 } 2421 2422 static Rappture::CmdSpec polyDataOps[] = { 2423 {"add", 1, PolyDataAddOp, 2, 3, "?dataSetName?"}, 2424 {"color", 1, PolyDataColorOp, 5, 6, "r g b ?dataSetName?"}, 2425 {"delete", 1, PolyDataDeleteOp, 2, 3, "?dataSetName?"}, 2426 {"edges", 1, PolyDataEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"}, 2427 {"lighting", 3, PolyDataLightingOp, 3, 4, "bool ?dataSetName?"}, 2428 {"linecolor", 5, PolyDataLineColorOp, 5, 6, "r g b ?dataSetName?"}, 2429 {"linewidth", 5, PolyDataLineWidthOp, 3, 4, "width ?dataSetName?"}, 2430 {"opacity", 1, PolyDataOpacityOp, 3, 4, "value ?dataSetName?"}, 2431 {"visible", 1, PolyDataVisibleOp, 3, 4, "bool ?dataSetName?"}, 2432 {"wireframe", 1, PolyDataWireframeOp, 3, 4, "bool ?dataSetName?"} 2433 }; 2434 static int nPolyDataOps = NumCmdSpecs(polyDataOps); 2435 2436 static int 2437 PolyDataCmd(ClientData clientData, Tcl_Interp *interp, int objc, 2438 Tcl_Obj *const *objv) 2439 { 2440 Tcl_ObjCmdProc *proc; 2441 2442 proc = Rappture::GetOpFromObj(interp, nPolyDataOps, polyDataOps, 2443 Rappture::CMDSPEC_ARG1, objc, objv, 0); 2444 if (proc == NULL) { 2445 return TCL_ERROR; 2446 } 2447 return (*proc) (clientData, interp, objc, objv); 2448 } 2449 2450 static int 1800 2451 PseudoColorAddOp(ClientData clientData, Tcl_Interp *interp, int objc, 1801 2452 Tcl_Obj *const *objv) … … 1979 2630 1980 2631 proc = Rappture::GetOpFromObj(interp, nPseudoColorOps, pseudoColorOps, 1981 Rappture::CMDSPEC_ARG1, objc, objv, 0);1982 if (proc == NULL) {1983 return TCL_ERROR;1984 }1985 return (*proc) (clientData, interp, objc, objv);1986 }1987 1988 static int1989 PolyDataAddOp(ClientData clientData, Tcl_Interp *interp, int objc,1990 Tcl_Obj *const *objv)1991 {1992 if (objc == 3) {1993 const char *name = Tcl_GetString(objv[2]);1994 g_renderer->addPolyData(name);1995 } else {1996 g_renderer->addPolyData("all");1997 }1998 return TCL_OK;1999 }2000 2001 static int2002 PolyDataDeleteOp(ClientData clientData, Tcl_Interp *interp, int objc,2003 Tcl_Obj *const *objv)2004 {2005 if (objc == 3) {2006 const char *name = Tcl_GetString(objv[2]);2007 g_renderer->deletePolyData(name);2008 } else {2009 g_renderer->deletePolyData("all");2010 }2011 return TCL_OK;2012 }2013 2014 static int2015 PolyDataColorOp(ClientData clientData, Tcl_Interp *interp, int objc,2016 Tcl_Obj *const *objv)2017 {2018 float color[3];2019 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||2020 GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK ||2021 GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) {2022 return TCL_ERROR;2023 }2024 if (objc == 6) {2025 const char *name = Tcl_GetString(objv[5]);2026 g_renderer->setPolyDataColor(name, color);2027 } else {2028 g_renderer->setPolyDataColor("all", color);2029 }2030 return TCL_OK;2031 }2032 2033 static int2034 PolyDataEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc,2035 Tcl_Obj *const *objv)2036 {2037 bool state;2038 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {2039 return TCL_ERROR;2040 }2041 if (objc == 4) {2042 const char *name = Tcl_GetString(objv[3]);2043 g_renderer->setPolyDataEdgeVisibility(name, state);2044 } else {2045 g_renderer->setPolyDataEdgeVisibility("all", state);2046 }2047 return TCL_OK;2048 }2049 2050 static int2051 PolyDataLightingOp(ClientData clientData, Tcl_Interp *interp, int objc,2052 Tcl_Obj *const *objv)2053 {2054 bool state;2055 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {2056 return TCL_ERROR;2057 }2058 if (objc == 4) {2059 const char *name = Tcl_GetString(objv[3]);2060 g_renderer->setPolyDataLighting(name, state);2061 } else {2062 g_renderer->setPolyDataLighting("all", state);2063 }2064 return TCL_OK;2065 }2066 2067 static int2068 PolyDataLineColorOp(ClientData clientData, Tcl_Interp *interp, int objc,2069 Tcl_Obj *const *objv)2070 {2071 float color[3];2072 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||2073 GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK ||2074 GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) {2075 return TCL_ERROR;2076 }2077 if (objc == 6) {2078 const char *name = Tcl_GetString(objv[5]);2079 g_renderer->setPolyDataEdgeColor(name, color);2080 } else {2081 g_renderer->setPolyDataEdgeColor("all", color);2082 }2083 return TCL_OK;2084 }2085 2086 static int2087 PolyDataLineWidthOp(ClientData clientData, Tcl_Interp *interp, int objc,2088 Tcl_Obj *const *objv)2089 {2090 float width;2091 if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) {2092 return TCL_ERROR;2093 }2094 if (objc == 4) {2095 const char *name = Tcl_GetString(objv[3]);2096 g_renderer->setPolyDataEdgeWidth(name, width);2097 } else {2098 g_renderer->setPolyDataEdgeWidth("all", width);2099 }2100 return TCL_OK;2101 }2102 2103 static int2104 PolyDataOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc,2105 Tcl_Obj *const *objv)2106 {2107 double opacity;2108 if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) {2109 return TCL_ERROR;2110 }2111 if (objc == 4) {2112 const char *name = Tcl_GetString(objv[3]);2113 g_renderer->setPolyDataOpacity(name, opacity);2114 } else {2115 g_renderer->setPolyDataOpacity("all", opacity);2116 }2117 return TCL_OK;2118 }2119 2120 static int2121 PolyDataVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc,2122 Tcl_Obj *const *objv)2123 {2124 bool state;2125 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {2126 return TCL_ERROR;2127 }2128 if (objc == 4) {2129 const char *name = Tcl_GetString(objv[3]);2130 g_renderer->setPolyDataVisibility(name, state);2131 } else {2132 g_renderer->setPolyDataVisibility("all", state);2133 }2134 return TCL_OK;2135 }2136 2137 static int2138 PolyDataWireframeOp(ClientData clientData, Tcl_Interp *interp, int objc,2139 Tcl_Obj *const *objv)2140 {2141 bool state;2142 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {2143 return TCL_ERROR;2144 }2145 if (objc == 4) {2146 const char *name = Tcl_GetString(objv[3]);2147 g_renderer->setPolyDataWireframe(name, state);2148 } else {2149 g_renderer->setPolyDataWireframe("all", state);2150 }2151 return TCL_OK;2152 }2153 2154 static Rappture::CmdSpec polyDataOps[] = {2155 {"add", 1, PolyDataAddOp, 2, 3, "?dataSetName?"},2156 {"color", 1, PolyDataColorOp, 5, 6, "r g b ?dataSetName?"},2157 {"delete", 1, PolyDataDeleteOp, 2, 3, "?dataSetName?"},2158 {"edges", 1, PolyDataEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"},2159 {"lighting", 3, PolyDataLightingOp, 3, 4, "bool ?dataSetName?"},2160 {"linecolor", 5, PolyDataLineColorOp, 5, 6, "r g b ?dataSetName?"},2161 {"linewidth", 5, PolyDataLineWidthOp, 3, 4, "width ?dataSetName?"},2162 {"opacity", 1, PolyDataOpacityOp, 3, 4, "value ?dataSetName?"},2163 {"visible", 1, PolyDataVisibleOp, 3, 4, "bool ?dataSetName?"},2164 {"wireframe", 1, PolyDataWireframeOp, 3, 4, "bool ?dataSetName?"}2165 };2166 static int nPolyDataOps = NumCmdSpecs(polyDataOps);2167 2168 static int2169 PolyDataCmd(ClientData clientData, Tcl_Interp *interp, int objc,2170 Tcl_Obj *const *objv)2171 {2172 Tcl_ObjCmdProc *proc;2173 2174 proc = Rappture::GetOpFromObj(interp, nPolyDataOps, polyDataOps,2175 2632 Rappture::CMDSPEC_ARG1, objc, objv, 0); 2176 2633 if (proc == NULL) { … … 2964 3421 Tcl_CreateObjCommand(interp, "heightmap", HeightMapCmd, NULL, NULL); 2965 3422 Tcl_CreateObjCommand(interp, "legend", LegendCmd, NULL, NULL); 3423 Tcl_CreateObjCommand(interp, "lic", LICCmd, NULL, NULL); 3424 Tcl_CreateObjCommand(interp, "molecule", MoleculeCmd, NULL, NULL); 2966 3425 Tcl_CreateObjCommand(interp, "polydata", PolyDataCmd, NULL, NULL); 2967 3426 Tcl_CreateObjCommand(interp, "pseudocolor", PseudoColorCmd, NULL, NULL); … … 2989 3448 Tcl_DeleteCommand(interp, "heightmap"); 2990 3449 Tcl_DeleteCommand(interp, "legend"); 3450 Tcl_DeleteCommand(interp, "lic"); 3451 Tcl_DeleteCommand(interp, "molecule"); 2991 3452 Tcl_DeleteCommand(interp, "polydata"); 2992 3453 Tcl_DeleteCommand(interp, "pseudocolor"); -
trunk/packages/vizservers/vtkvis/protocol.txt
r2318 r2320 127 127 For 3D data, select a slice along a principle axis of the volume. The 128 128 ratio is [0,1] 129 130 lic add <?datasetName?> 131 lic colormap <colormapName> <?datasetName?> 132 lic delete <?datasetName?> 133 lic edges <bool> <?datasetName?> 134 lic lighting <bool> <?datasetName?> 135 lic linecolor <r> <g> <b> <?datasetName?> 136 lic linewidth <val> <?datasetName?> 137 lic opacity <val> <?datasetName?> 138 lic visible <bool> <?datasetName?> 139 lic volumeslice <axis> <ratio> <?datasetName?> 140 141 molecule add <?datasetName?> 142 molecule atoms <bool> <?datasetName?> 143 Toggle rendering of atoms 144 molecule bonds <bool> <?datasetName?> 145 Toggle rendering of bonds 146 molecule colormap <colormapName> <?datasetName?> 147 molecule delete <?datasetName?> 148 molecule edges <bool> <?datasetName?> 149 molecule lighting <bool> <?datasetName?> 150 molecule linecolor <r> <g> <b> <?datasetName?> 151 molecule linewidth <val> <?datasetName?> 152 molecule opacity <val> <?datasetName?> 153 molecule scaleatoms <val> <?dataSetName?> 154 val = van_der_walls|covalent|atomic|none 155 molecule visible <bool> <?datasetName?> 156 molecule wireframe <bool> <?datasetName?> 129 157 130 158 polydata add <?datasetName?> -
trunk/packages/vizservers/vtkvis/vtkRpCubeAxesActor2D.h
r2100 r2320 41 41 // vtkActor2D vtkAxisActor2D vtkXYPlotActor vtkTextProperty 42 42 43 #ifndef __vtk CubeAxesActor2D_h44 #define __vtk CubeAxesActor2D_h43 #ifndef __vtkRpCubeAxesActor2D_h 44 #define __vtkRpCubeAxesActor2D_h 45 45 46 46 #include "vtkActor2D.h"
Note: See TracChangeset
for help on using the changeset viewer.