Ignore:
Timestamp:
Sep 15, 2011, 10:45:04 AM (13 years ago)
Author:
ldelgass
Message:

Streamlines max propagation is _always_ world coordinates -- fix the default
and add a bit of default length. New heuristic is sum of x,y,z bounds. Fix
colormapping when input dataset has only cell data.

File:
1 edited

Legend:

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

    r2510 r2513  
    422422    double bounds[6];
    423423    _dataSet->getBounds(bounds);
     424    double xLen = bounds[1] - bounds[0];
     425    double yLen = bounds[3] - bounds[2];
     426    double zLen = bounds[5] - bounds[4];
    424427    double maxBound = 0.0;
    425     if (bounds[1] - bounds[0] > maxBound) {
    426         maxBound = bounds[1] - bounds[0];
    427     }
    428     if (bounds[3] - bounds[2] > maxBound) {
    429         maxBound = bounds[3] - bounds[2];
    430     }
    431     if (bounds[5] - bounds[4] > maxBound) {
    432         maxBound = bounds[5] - bounds[4];
     428    if (xLen > maxBound) {
     429        maxBound = xLen;
     430    }
     431    if (yLen > maxBound) {
     432        maxBound = yLen;
     433    }
     434    if (zLen > maxBound) {
     435        maxBound = zLen;
    433436    }
    434437
     
    461464
    462465    _streamTracer->SetInput(ds);
    463     _streamTracer->SetMaximumPropagation(2.0 * maxBound / avgSize);
     466    _streamTracer->SetMaximumPropagation(xLen + yLen + zLen);
    464467    _streamTracer->SetIntegratorTypeToRungeKutta45();
     468
     469    TRACE("Setting streamlines max length to %g",
     470          _streamTracer->GetMaximumPropagation());
    465471
    466472    if (_pdMapper == NULL) {
     
    10001006 * \brief Set the step size units.  Length units are world
    10011007 * coordinates, and cell units means steps are from cell to
    1002  * cell.  Default is cell units
     1008 * cell.  Default is cell units.
     1009 *
     1010 * Note: calling this function will not convert existing
     1011 * initial, minimum or maximum step value settings to the
     1012 * new units, so this function should be called before
     1013 * setting step values.
    10031014 */
    10041015void Streamlines::setIntegrationStepUnit(StepUnit unit)
     
    10631074
    10641075/**
    1065  * \brief Set maximum length of stream lines in integration
    1066  * step units (see setIntegrationStepUnit)
     1076 * \brief Set maximum length of stream lines in world
     1077 * coordinates
    10671078 */
    10681079void Streamlines::setMaxPropagation(double length)
     
    11961207        return;
    11971208
    1198     vtkDataSet *ds = _dataSet->getVtkDataSet();
    1199 
    12001209    switch (mode) {
    12011210    case COLOR_BY_SCALAR: {
     
    12101219        _pdMapper->ScalarVisibilityOn();
    12111220        _pdMapper->SetScalarModeToUsePointFieldData();
    1212         if (ds->GetPointData() != NULL &&
    1213             ds->GetPointData()->GetVectors() != NULL) {
    1214             _pdMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName());
    1215         }
     1221        _pdMapper->SelectColorArray(_dataSet->getActiveVectorsName());
    12161222        if (_lut != NULL) {
    12171223            _lut->SetRange(_vectorMagnitudeRange);
     
    12231229        _pdMapper->ScalarVisibilityOn();
    12241230        _pdMapper->SetScalarModeToUsePointFieldData();
    1225         if (ds->GetPointData() != NULL &&
    1226             ds->GetPointData()->GetVectors() != NULL) {
    1227             _pdMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName());
    1228         }
     1231        _pdMapper->SelectColorArray(_dataSet->getActiveVectorsName());
    12291232        if (_lut != NULL) {
    12301233            _lut->SetRange(_vectorComponentRange[0]);
     
    12361239        _pdMapper->ScalarVisibilityOn();
    12371240        _pdMapper->SetScalarModeToUsePointFieldData();
    1238         if (ds->GetPointData() != NULL &&
    1239             ds->GetPointData()->GetVectors() != NULL) {
    1240             _pdMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName());
    1241         }
     1241        _pdMapper->SelectColorArray(_dataSet->getActiveVectorsName());
    12421242        if (_lut != NULL) {
    12431243            _lut->SetRange(_vectorComponentRange[1]);
     
    12491249        _pdMapper->ScalarVisibilityOn();
    12501250        _pdMapper->SetScalarModeToUsePointFieldData();
    1251         if (ds->GetPointData() != NULL &&
    1252             ds->GetPointData()->GetVectors() != NULL) {
    1253             _pdMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName());
    1254         }
     1251        _pdMapper->SelectColorArray(_dataSet->getActiveVectorsName());
    12551252        if (_lut != NULL) {
    12561253            _lut->SetRange(_vectorComponentRange[2]);
Note: See TracChangeset for help on using the changeset viewer.