Ignore:
Timestamp:
Jun 2, 2011, 2:21:08 PM (13 years ago)
Author:
ldelgass
Message:

Add glyphs command/object for rendering 3D glyph objects at all points in a
data set with scaling and color mapping. Useful for vector field hedgehogs
and general 3D scatter plots. Still need to deal with data ranges better and
add options for using vector mag. vs. components for scaling, etc.
Also compute point data when only cell data is present and point data is needed.
Probably this should be done in the DataSet? class instead to minimize
duplicating work.

File:
1 edited

Legend:

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

    r2263 r2269  
    99
    1010#include <vtkDataSet.h>
     11#include <vtkPointData.h>
     12#include <vtkCellData.h>
     13#include <vtkCellDataToPointData.h>
    1114#include <vtkDataSetMapper.h>
    1215#include <vtkPolyDataMapper.h>
    1316#include <vtkUnstructuredGrid.h>
    1417#include <vtkProperty.h>
    15 #include <vtkPointData.h>
    1618#include <vtkImageData.h>
    1719#include <vtkLookupTable.h>
     
    3032using namespace Rappture::VtkVis;
    3133
    32 #define MESH_POINTS
     34//#define MESH_POINTS
    3335
    3436HeightMap::HeightMap() :
     
    112114
    113115    if (_transformedData == NULL) {
     116        vtkSmartPointer<vtkCellDataToPointData> cellToPtData;
     117
     118        if (ds->GetPointData() == NULL ||
     119            ds->GetPointData()->GetScalars() == NULL) {
     120            ERROR("No scalar point data in dataset %s", _dataSet->getName().c_str());
     121            if (ds->GetCellData() != NULL &&
     122                ds->GetCellData()->GetScalars() != NULL) {
     123                cellToPtData =
     124                    vtkSmartPointer<vtkCellDataToPointData>::New();
     125                cellToPtData->SetInput(ds);
     126                ds = cellToPtData->GetOutput();
     127            } else {
     128                ERROR("No scalar cell data in dataset %s", _dataSet->getName().c_str());
     129            }
     130        }
     131
    114132        vtkPolyData *pd = vtkPolyData::SafeDownCast(ds);
    115133        if (pd != NULL) {
     
    214232                gf->SetInput(_volumeSlicer->GetOutput());
    215233            } else {
    216                 // structured grid, unstructured grid, or rectilinear grid
     234                // 2D image data, structured grid, unstructured grid, or rectilinear grid
    217235                gf->SetInput(ds);
    218236            }
     
    243261            if (lut)
    244262                _lut = lut;
    245             else
     263            else {
    246264                _lut = vtkSmartPointer<vtkLookupTable>::New();
     265            }
    247266        }
    248267    }
Note: See TracChangeset for help on using the changeset viewer.