Ignore:
Timestamp:
Jun 5, 2011, 1:26:07 PM (13 years ago)
Author:
ldelgass
Message:
  • Convert to newer VTK pipeline methods where applicable: i.e. use

InputConnection/OutputPort? instead of Input/Output?. The old, deprecated
methods may be removed in VTK 6.

  • Disconnect vtkDataSet from reader pipeline after reading data. Allows reader

to be deleted ("garbage collected") after data is read. This also fixes a
potential read of freed memory (the memory allocated by the Tcl command
handler for the VTK data "file").

  • Remove vtkWarpScalar filter from HeightMap? pipeline when the height scaling

is set to zero.

  • Fix for removing clip planes when switching from image camera mode to

perspecive or ortho.

File:
1 edited

Legend:

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

    r2269 r2270  
    114114        _contourFilter = vtkSmartPointer<vtkContourFilter>::New();
    115115    }
    116  
    117     vtkSmartPointer<vtkCellDataToPointData> cellToPtData;
    118116
    119117    if (ds->GetPointData() == NULL ||
    120118        ds->GetPointData()->GetScalars() == NULL) {
    121         ERROR("No scalar point data in dataset %s", _dataSet->getName().c_str());
     119        WARN("No scalar point data in dataset %s", _dataSet->getName().c_str());
    122120        if (ds->GetCellData() != NULL &&
    123121            ds->GetCellData()->GetScalars() != NULL) {
     122            vtkSmartPointer<vtkCellDataToPointData> cellToPtData;
    124123            cellToPtData =
    125124                vtkSmartPointer<vtkCellDataToPointData>::New();
    126125            cellToPtData->SetInput(ds);
     126            //cellToPtData->PassCellDataOn();
     127            cellToPtData->Update();
    127128            ds = cellToPtData->GetOutput();
    128129        } else {
     
    141142                vtkSmartPointer<vtkDelaunay2D> mesher = vtkSmartPointer<vtkDelaunay2D>::New();
    142143                mesher->SetInput(pd);
    143                 pd = mesher->GetOutput();
    144                 assert(pd);
    145                 _contourFilter->SetInput(pd);
     144                _contourFilter->SetInputConnection(mesher->GetOutputPort());
    146145            } else {
    147146                vtkSmartPointer<vtkDelaunay3D> mesher = vtkSmartPointer<vtkDelaunay3D>::New();
    148147                mesher->SetInput(pd);
    149148                vtkSmartPointer<vtkDataSetSurfaceFilter> gf = vtkSmartPointer<vtkDataSetSurfaceFilter>::New();
    150                 gf->SetInput(mesher->GetOutput());
    151                 gf->Update();
    152                 pd = gf->GetOutput();
    153                 assert(pd);
    154                 _contourFilter->SetInput(pd);
    155              }
     149                gf->SetInputConnection(mesher->GetOutputPort());
     150                _contourFilter->SetInputConnection(gf->GetOutputPort());
     151            }
    156152        } else {
    157153            // DataSet is a vtkPolyData with lines and/or polygons
     
    163159        vtkSmartPointer<vtkDataSetSurfaceFilter> gf = vtkSmartPointer<vtkDataSetSurfaceFilter>::New();
    164160        gf->SetInput(ds);
    165         gf->Update();
    166         pd = gf->GetOutput();
    167         assert(pd);
    168         _contourFilter->SetInput(pd);
     161        _contourFilter->SetInputConnection(gf->GetOutputPort());
    169162    }
    170163
     
    193186        _contourMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    194187        _contourMapper->SetResolveCoincidentTopologyToPolygonOffset();
    195         _contourMapper->SetInput(_contourFilter->GetOutput());
     188        _contourMapper->SetInputConnection(_contourFilter->GetOutputPort());
    196189        _contourActor->SetMapper(_contourMapper);
    197190    }
     191
     192    _contourMapper->Update();
    198193}
    199194
Note: See TracChangeset for help on using the changeset viewer.