Changeset 2402 for trunk/packages/vizservers/vtkvis/RpVolume.cpp
- Timestamp:
- Aug 22, 2011, 2:15:12 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/RpVolume.cpp
r2328 r2402 63 63 vtkDataSet *ds = _dataSet->getVtkDataSet(); 64 64 65 double dataRange[2];66 _dataSet->getDataRange(dataRange);67 68 TRACE("DataSet type: %s, range: %g - %g", _dataSet->getVtkType(),69 dataRange[0], dataRange[1]);70 71 65 if (vtkImageData::SafeDownCast(ds) != NULL) { 72 66 // Image data required for these mappers … … 113 107 WARN("No scalar point data in dataset %s", _dataSet->getName().c_str()); 114 108 } 109 115 110 if (_colorMap == NULL) { 116 _colorMap = ColorMap::getVolumeDefault();111 setColorMap(ColorMap::getVolumeDefault()); 117 112 } 118 119 vtkVolumeProperty *volProperty = getVolume()->GetProperty();120 volProperty->SetColor(_colorMap->getColorTransferFunction(dataRange));121 volProperty->SetScalarOpacity(_colorMap->getOpacityTransferFunction(dataRange));122 113 123 114 getVolume()->SetMapper(_volumeMapper); 124 115 _volumeMapper->Update(); 116 } 117 118 void Volume::updateRanges(bool useCumulative, 119 double scalarRange[2], 120 double vectorMagnitudeRange[2], 121 double vectorComponentRange[3][2]) 122 { 123 if (useCumulative) { 124 _dataRange[0] = scalarRange[0]; 125 _dataRange[1] = scalarRange[1]; 126 } else if (_dataSet != NULL) { 127 _dataSet->getScalarRange(_dataRange); 128 } 129 130 if (getVolume() != NULL) { 131 getVolume()->GetProperty()->SetColor(_colorMap->getColorTransferFunction(_dataRange)); 132 getVolume()->GetProperty()->SetScalarOpacity(_colorMap->getOpacityTransferFunction(_dataRange)); 133 } 134 } 135 void Volume::updateColorMap() 136 { 137 setColorMap(_colorMap); 125 138 } 126 139 … … 131 144 { 132 145 _colorMap = cmap; 146 133 147 if (getVolume() != NULL) { 134 double dataRange[2]; 135 _dataSet->getDataRange(dataRange); 136 getVolume()->GetProperty()->SetColor(_colorMap->getColorTransferFunction(dataRange)); 137 getVolume()->GetProperty()->SetScalarOpacity(_colorMap->getOpacityTransferFunction(dataRange)); 138 } 139 } 140 141 /** 142 * \brief Assign a color map (transfer function) to use in rendering the Volume and 143 * specify a scalar range for the map 144 */ 145 void Volume::setColorMap(ColorMap *cmap, double dataRange[2]) 146 { 147 _colorMap = cmap; 148 if (getVolume() != NULL) { 149 getVolume()->GetProperty()->SetColor(_colorMap->getColorTransferFunction(dataRange)); 150 getVolume()->GetProperty()->SetScalarOpacity(_colorMap->getOpacityTransferFunction(dataRange)); 148 getVolume()->GetProperty()->SetColor(_colorMap->getColorTransferFunction(_dataRange)); 149 getVolume()->GetProperty()->SetScalarOpacity(_colorMap->getOpacityTransferFunction(_dataRange)); 151 150 } 152 151 }
Note: See TracChangeset
for help on using the changeset viewer.