Ignore:
Timestamp:
Aug 22, 2011, 2:15:12 AM (13 years ago)
Author:
ldelgass
Message:
  • Let graphics objects handle DataSet? cumulative range changes, track vectors as well as scalars, also supply cumulative ranges in setDataSet()
  • Be more consistent about naming enums and commands for vectors
  • Add constructor arguments to some graphics objects to speed initialization (eliminates some pipeline changes)
  • Apply a scale factor to glyphs based on cell sizes
  • Add line glyph shape
  • Don't delete ColorMaps? in use
  • Update graphics objects when a ColorMap? is edited
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/vtkvis/RpVolume.cpp

    r2328 r2402  
    6363    vtkDataSet *ds = _dataSet->getVtkDataSet();
    6464
    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 
    7165    if (vtkImageData::SafeDownCast(ds) != NULL) {
    7266        // Image data required for these mappers
     
    113107        WARN("No scalar point data in dataset %s", _dataSet->getName().c_str());
    114108    }
     109
    115110    if (_colorMap == NULL) {
    116         _colorMap = ColorMap::getVolumeDefault();
     111        setColorMap(ColorMap::getVolumeDefault());
    117112    }
    118 
    119     vtkVolumeProperty *volProperty = getVolume()->GetProperty();
    120     volProperty->SetColor(_colorMap->getColorTransferFunction(dataRange));
    121     volProperty->SetScalarOpacity(_colorMap->getOpacityTransferFunction(dataRange));
    122113
    123114    getVolume()->SetMapper(_volumeMapper);
    124115    _volumeMapper->Update();
     116}
     117
     118void 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}
     135void Volume::updateColorMap()
     136{
     137    setColorMap(_colorMap);
    125138}
    126139
     
    131144{
    132145    _colorMap = cmap;
     146
    133147    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));
    151150    }
    152151}
Note: See TracChangeset for help on using the changeset viewer.