Changeset 2523


Ignore:
Timestamp:
Sep 18, 2011 10:49:05 PM (12 years ago)
Author:
ldelgass
Message:

Merge 2494:2522 from trunk

Location:
branches/vtkvis_threaded
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • branches/vtkvis_threaded/Makefile.in

    r2495 r2523  
    4747DEBUG                   = #yes
    4848TRACE                   = #yes
    49 USE_CUSTOM_AXES         = yes
    50 USE_GPU_RAYCASTING      = yes
    51 USE_OFFSCREEN_RENDERING = yes
     49HAVE_GLYPH3D_MAPPER     = #yes
     50USE_CUSTOM_AXES         = yes
     51USE_GPU_RAYCASTING      = yes
     52USE_OFFSCREEN_RENDERING = yes
    5253USE_THREADS             = yes
    5354
     
    6162ifdef TRACE
    6263DEFINES         += -DWANT_TRACE
     64endif
     65ifdef HAVE_GLYPH3D_MAPPER
     66DEFINES         += -DHAVE_GLYPH3D_MAPPER
    6367endif
    6468ifdef USE_CUSTOM_AXES
     
    8286                RpContour2D.cpp \
    8387                RpContour3D.cpp \
     88                RpCutplane.cpp \
    8489                RpGlyphs.cpp \
    8590                RpHeightMap.cpp \
     
    140145RpContour2D.o: RpContour2D.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h
    141146RpContour3D.o: RpContour3D.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h
     147RpCutplane.o: RpCutplane.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h
    142148RpGlyphs.o: RpGlyphs.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h
    143149RpHeightMap.o: RpHeightMap.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h
     
    149155RpVolume.o: RpVolume.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h
    150156RpVtkDataSet.o: RpVtkDataSet.h Trace.h
    151 RpVtkRenderer.o: RpVtkRenderer.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h
    152 RpVtkRendererCmd.o: RpVtkRenderer.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h ResponseQueue.h Trace.h CmdProc.h PPMWriter.h TGAWriter.h
    153 RpVtkRenderServer.o: RpVtkRenderServer.h RpVtkRendererCmd.h RpVtkRenderer.h ResponseQueue.h Trace.h PPMWriter.h TGAWriter.h
     157RpVtkRenderer.o: RpVtkRenderer.h vtkRpCubeAxesActor2D.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h
     158RpVtkRendererCmd.o: RpVtkRenderer.h vtkRpCubeAxesActor2D.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h ResponseQueue.h Trace.h CmdProc.h PPMWriter.h TGAWriter.h
     159RpVtkRenderServer.o: RpVtkRenderServer.h RpVtkRendererCmd.h RpVtkRenderer.h vtkRpCubeAxesActor2D.h ResponseQueue.h Trace.h PPMWriter.h TGAWriter.h
    154160Trace.o: Trace.h
    155161TGAWriter.o: TGAWriter.h ResponseQueue.h Trace.h
  • branches/vtkvis_threaded/RpContour3D.cpp

    r2459 r2523  
    172172        _contourMapper->SetResolveCoincidentTopologyToPolygonOffset();
    173173        _contourMapper->SetInputConnection(_contourFilter->GetOutputPort());
     174        _contourMapper->SetColorModeToMapScalars();
    174175        getActor()->SetMapper(_contourMapper);
    175176    }
  • branches/vtkvis_threaded/RpHeightMap.cpp

    r2459 r2523  
    9191                _dataRange[1] = scalarRange[1];
    9292            } else {
    93                 dataSet->getScalarRange(_dataRange);
     93                _dataSet->getScalarRange(_dataRange);
    9494            }
    9595
  • branches/vtkvis_threaded/RpHeightMap.h

    r2457 r2523  
    7373    void setHeightScale(double scale);
    7474
     75    double getHeightScale()
     76    {
     77        return _warpScale;
     78    }
     79
    7580    void setNumContours(int numContours);
    7681
  • branches/vtkvis_threaded/RpLIC.cpp

    r2459 r2523  
    2424#include "RpLIC.h"
    2525#include "Trace.h"
    26 #include "RpVtkRenderServer.h"
    2726
    2827using namespace Rappture::VtkVis;
  • branches/vtkvis_threaded/RpPseudoColor.cpp

    r2496 r2523  
    1010#include <vtkDataSet.h>
    1111#include <vtkPointData.h>
     12#include <vtkCellData.h>
    1213#include <vtkDataSetMapper.h>
    1314#include <vtkUnstructuredGrid.h>
     
    235236    case COLOR_BY_VECTOR_MAGNITUDE: {
    236237        _dsMapper->ScalarVisibilityOn();
    237         _dsMapper->SetScalarModeToUsePointFieldData();
    238238        if (ds->GetPointData() != NULL &&
    239239            ds->GetPointData()->GetVectors() != NULL) {
     240            _dsMapper->SetScalarModeToUsePointFieldData();
    240241            _dsMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName());
     242        } else if (ds->GetCellData() != NULL &&
     243                   ds->GetCellData()->GetVectors() != NULL) {
     244            _dsMapper->SetScalarModeToUseCellFieldData();
     245            _dsMapper->SelectColorArray(ds->GetCellData()->GetVectors()->GetName());
    241246        }
    242247        if (_lut != NULL) {
     
    248253    case COLOR_BY_VECTOR_X:
    249254        _dsMapper->ScalarVisibilityOn();
    250         _dsMapper->SetScalarModeToUsePointFieldData();
    251255        if (ds->GetPointData() != NULL &&
    252256            ds->GetPointData()->GetVectors() != NULL) {
     257            _dsMapper->SetScalarModeToUsePointFieldData();
    253258            _dsMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName());
     259        } else if (ds->GetCellData() != NULL &&
     260                   ds->GetCellData()->GetVectors() != NULL) {
     261            _dsMapper->SetScalarModeToUseCellFieldData();
     262            _dsMapper->SelectColorArray(ds->GetCellData()->GetVectors()->GetName());
    254263        }
    255264        if (_lut != NULL) {
     
    261270    case COLOR_BY_VECTOR_Y:
    262271        _dsMapper->ScalarVisibilityOn();
    263         _dsMapper->SetScalarModeToUsePointFieldData();
    264272        if (ds->GetPointData() != NULL &&
    265273            ds->GetPointData()->GetVectors() != NULL) {
     274            _dsMapper->SetScalarModeToUsePointFieldData();
    266275            _dsMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName());
     276        } else if (ds->GetCellData() != NULL &&
     277                   ds->GetCellData()->GetVectors() != NULL) {
     278            _dsMapper->SetScalarModeToUseCellFieldData();
     279            _dsMapper->SelectColorArray(ds->GetCellData()->GetVectors()->GetName());
    267280        }
    268281        if (_lut != NULL) {
     
    274287    case COLOR_BY_VECTOR_Z:
    275288        _dsMapper->ScalarVisibilityOn();
    276         _dsMapper->SetScalarModeToUsePointFieldData();
    277289        if (ds->GetPointData() != NULL &&
    278290            ds->GetPointData()->GetVectors() != NULL) {
     291            _dsMapper->SetScalarModeToUsePointFieldData();
    279292            _dsMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName());
     293        } else if (ds->GetCellData() != NULL &&
     294                   ds->GetCellData()->GetVectors() != NULL) {
     295            _dsMapper->SetScalarModeToUseCellFieldData();
     296            _dsMapper->SelectColorArray(ds->GetCellData()->GetVectors()->GetName());
    280297        }
    281298        if (_lut != NULL) {
  • branches/vtkvis_threaded/RpStreamlines.cpp

    r2467 r2523  
    2121#include <vtkCellData.h>
    2222#include <vtkCellDataToPointData.h>
     23#include <vtkPolygon.h>
    2324#include <vtkPolyData.h>
    2425#include <vtkTubeFilter.h>
     
    2627#include <vtkTransform.h>
    2728#include <vtkTransformPolyDataFilter.h>
     29#include <vtkVertexGlyphFilter.h>
    2830
    2931#include "RpStreamlines.h"
     
    123125        _seedActor = vtkSmartPointer<vtkActor>::New();
    124126        _seedActor->GetProperty()->SetColor(_seedColor[0], _seedColor[1], _seedColor[2]);
     127        _seedActor->GetProperty()->SetEdgeColor(_seedColor[0], _seedColor[1], _seedColor[2]);
    125128        _seedActor->GetProperty()->SetLineWidth(1);
    126129        _seedActor->GetProperty()->SetPointSize(2);
     
    172175 */
    173176void Streamlines::getRandomPointInTriangle(double pt[3],
     177                                           const double v0[3],
    174178                                           const double v1[3],
    175                                            const double v2[3],
    176                                            const double v3[3])
     179                                           const double v2[3])
    177180{
    178181    // Choose random barycentric coordinates
     
    189192    // Convert to cartesian coords
    190193    for (int i = 0; i < 3; i++) {
    191         pt[i] = v1[i] * bary[0] + v2[i] * bary[1] + v3[i] * bary[2];
     194        pt[i] = v0[i] * bary[0] + v1[i] * bary[1] + v2[i] * bary[2];
     195    }
     196}
     197
     198void Streamlines::getRandomPointInTetrahedron(double pt[3],
     199                                              const double v0[3],
     200                                              const double v1[3],
     201                                              const double v2[3],
     202                                              const double v3[3])
     203{
     204    // Choose random barycentric coordinates
     205    double bary[4];
     206    bary[0] = getRandomNum(0, 1);
     207    bary[1] = getRandomNum(0, 1);
     208    bary[2] = getRandomNum(0, 1);
     209    if (bary[0] + bary[1] > 1.0) {
     210        bary[0] = 1.0 - bary[0];
     211        bary[1] = 1.0 - bary[1];
     212    }
     213    if (bary[1] + bary[2] > 1.0) {
     214        double tmp = bary[2];
     215        bary[2] = 1.0 - bary[0] - bary[1];
     216        bary[1] = 1.0 - tmp;
     217    } else if (bary[0] + bary[1] + bary[2] > 1.0) {
     218        double tmp = bary[2];
     219        bary[2] = bary[0] + bary[1] + bary[2] - 1.0;
     220        bary[0] = 1.0 - bary[1] - tmp;
     221    }
     222    bary[3] = 1.0 - bary[0] - bary[1] - bary[2];
     223    TRACE("bary %g %g %g %g", bary[0], bary[1], bary[2], bary[3]);
     224    // Convert to cartesian coords
     225    for (int i = 0; i < 3; i++) {
     226#if 0
     227        pt[i] = (v0[i] - v3[i]) * bary[0] +
     228                (v1[i] - v3[i]) * bary[1] +
     229                (v2[i] - v3[i]) * bary[2] + v3[i];
     230#else
     231        pt[i] = v0[i] * bary[0] + v1[i] * bary[1] +
     232                v2[i] * bary[2] + v3[i] * bary[3];
     233#endif
    192234    }
    193235}
     
    209251 * \brief Get a random point within a vtkDataSet's mesh
    210252 *
    211  * Note: This currently doesn't give a uniform distribution of
    212  * points in space and can generate points outside the mesh
     253 * Note: This currently doesn't always give a uniform distribution
     254 * of points in space and can generate points outside the mesh for
     255 * unusual cell types
    213256 */
    214257void Streamlines::getRandomCellPt(double pt[3], vtkDataSet *ds)
     
    218261    // all cells are equal area/volume)
    219262    int cell = rand() % numCells;
    220     double bounds[6];
    221     ds->GetCellBounds(cell, bounds);
    222     // Note: point is inside AABB of cell, but may be outside the cell
    223     getRandomPoint(pt, bounds);
     263    int type = ds->GetCellType(cell);
     264    if (type == VTK_VERTEX) {
     265        vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New();
     266        ds->GetCellPoints(cell, ptIds);
     267        assert(ptIds->GetNumberOfIds() == 1);
     268        ds->GetPoint(ptIds->GetId(0), pt);
     269    } else if (type == VTK_POLY_VERTEX) {
     270        vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New();
     271        ds->GetCellPoints(cell, ptIds);
     272        assert(ptIds->GetNumberOfIds() >= 1);
     273        int id = rand() % ptIds->GetNumberOfIds();
     274        ds->GetPoint(ptIds->GetId(id), pt);
     275    } else if (type == VTK_LINE) {
     276        double v[2][3];
     277        vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New();
     278        ds->GetCellPoints(cell, ptIds);
     279        assert(ptIds->GetNumberOfIds() == 2);
     280        for (int i = 0; i < 2; i++) {
     281            ds->GetPoint(ptIds->GetId(i), v[i]);
     282        }
     283        getRandomPointOnLineSegment(pt, v[0], v[1]);
     284    } else if (type == VTK_POLY_LINE) {
     285        double v[2][3];
     286        vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New();
     287        ds->GetCellPoints(cell, ptIds);
     288        assert(ptIds->GetNumberOfIds() >= 2);
     289        int id = rand() % (ptIds->GetNumberOfIds()-1);
     290        for (int i = 0; i < 2; i++) {
     291            ds->GetPoint(ptIds->GetId(id+i), v[i]);
     292        }
     293        getRandomPointOnLineSegment(pt, v[0], v[1]);
     294    } else if (type == VTK_TRIANGLE) {
     295        double v[3][3];
     296        vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New();
     297        ds->GetCellPoints(cell, ptIds);
     298        assert(ptIds->GetNumberOfIds() == 3);
     299        for (int i = 0; i < 3; i++) {
     300            ds->GetPoint(ptIds->GetId(i), v[i]);
     301        }
     302        getRandomPointInTriangle(pt, v[0], v[1], v[2]);
     303    } else if (type == VTK_TRIANGLE_STRIP) {
     304        double v[3][3];
     305        vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New();
     306        ds->GetCellPoints(cell, ptIds);
     307        assert(ptIds->GetNumberOfIds() >= 3);
     308        int id = rand() % (ptIds->GetNumberOfIds()-2);
     309        for (int i = 0; i < 3; i++) {
     310            ds->GetPoint(ptIds->GetId(id+i), v[i]);
     311        }
     312        getRandomPointInTriangle(pt, v[0], v[1], v[2]);
     313    } else if (type == VTK_POLYGON) {
     314        vtkPolygon *poly = vtkPolygon::SafeDownCast(ds->GetCell(cell));
     315        assert (poly != NULL);
     316        vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New();
     317        poly->Triangulate(ptIds);
     318        assert(ptIds->GetNumberOfIds() >= 3 && ptIds->GetNumberOfIds() % 3 == 0);
     319        int tri = rand() % (ptIds->GetNumberOfIds()/3);
     320        double v[3][3];
     321        for (int i = 0; i < 3; i++) {
     322            ds->GetPoint(ptIds->GetId(i + tri * 3), v[i]);
     323        }
     324        getRandomPointInTriangle(pt, v[0], v[1], v[2]);
     325    } else if (type == VTK_QUAD) {
     326        double v[4][3];
     327        vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New();
     328        ds->GetCellPoints(cell, ptIds);
     329        assert(ptIds->GetNumberOfIds() == 4);
     330        for (int i = 0; i < 4; i++) {
     331            ds->GetPoint(ptIds->GetId(i), v[i]);
     332        }
     333        int tri = rand() & 0x1;
     334        if (tri) {
     335            getRandomPointInTriangle(pt, v[0], v[1], v[2]);
     336        } else {
     337            getRandomPointInTriangle(pt, v[0], v[2], v[3]);
     338        }
     339    } else if (type == VTK_TETRA) {
     340        double v[4][3];
     341        vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New();
     342        ds->GetCellPoints(cell, ptIds);
     343        assert(ptIds->GetNumberOfIds() == 4);
     344        for (int i = 0; i < 4; i++) {
     345            ds->GetPoint(ptIds->GetId(i), v[i]);
     346        }
     347        getRandomPointInTetrahedron(pt, v[0], v[1], v[2], v[3]);
     348    } else if (type == VTK_HEXAHEDRON) {
     349        double v[8][3];
     350        vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New();
     351        ds->GetCellPoints(cell, ptIds);
     352        assert(ptIds->GetNumberOfIds() == 8);
     353        for (int i = 0; i < 8; i++) {
     354            ds->GetPoint(ptIds->GetId(i), v[i]);
     355        }
     356        int tetra = rand() % 5;
     357        switch (tetra) {
     358        case 0:
     359            getRandomPointInTetrahedron(pt, v[0], v[1], v[2], v[5]);
     360            break;
     361        case 1:
     362            getRandomPointInTetrahedron(pt, v[0], v[2], v[7], v[3]);
     363            break;
     364        case 2:
     365            getRandomPointInTetrahedron(pt, v[0], v[5], v[7], v[4]);
     366            break;
     367        case 3:
     368            getRandomPointInTetrahedron(pt, v[5], v[2], v[7], v[6]);
     369            break;
     370        case 4:
     371        default:
     372            getRandomPointInTetrahedron(pt, v[0], v[2], v[7], v[5]);
     373            break;
     374        }
     375    } else if (type == VTK_WEDGE) {
     376        double v[6][3];
     377        vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New();
     378        ds->GetCellPoints(cell, ptIds);
     379        assert(ptIds->GetNumberOfIds() == 6);
     380        for (int i = 0; i < 6; i++) {
     381            ds->GetPoint(ptIds->GetId(i), v[i]);
     382        }
     383        double vv[3][3];
     384        getRandomPointOnLineSegment(vv[0], v[0], v[3]);
     385        getRandomPointOnLineSegment(vv[1], v[1], v[4]);
     386        getRandomPointOnLineSegment(vv[2], v[2], v[5]);
     387        getRandomPointInTriangle(pt, vv[0], vv[1], vv[2]);
     388    } else if (type == VTK_PYRAMID) {
     389        double v[5][3];
     390        vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New();
     391        ds->GetCellPoints(cell, ptIds);
     392        assert(ptIds->GetNumberOfIds() == 5);
     393        for (int i = 0; i < 5; i++) {
     394            ds->GetPoint(ptIds->GetId(i), v[i]);
     395        }
     396        int tetra = rand() & 0x1;
     397        if (tetra) {
     398            getRandomPointInTetrahedron(pt, v[0], v[1], v[2], v[4]);
     399        } else {
     400            getRandomPointInTetrahedron(pt, v[0], v[2], v[3], v[4]);
     401        }
     402    } else {
     403        double bounds[6];
     404        ds->GetCellBounds(cell, bounds);
     405        // Note: For pixel/voxel cells, this is exact.  However, if the cell is
     406        // not an axis aligned box, the point may be outside the cell
     407        getRandomPoint(pt, bounds);
     408    }
    224409}
    225410
     
    237422    double bounds[6];
    238423    _dataSet->getBounds(bounds);
     424    double xLen = bounds[1] - bounds[0];
     425    double yLen = bounds[3] - bounds[2];
     426    double zLen = bounds[5] - bounds[4];
    239427    double maxBound = 0.0;
    240     if (bounds[1] - bounds[0] > maxBound) {
    241         maxBound = bounds[1] - bounds[0];
    242     }
    243     if (bounds[3] - bounds[2] > maxBound) {
    244         maxBound = bounds[3] - bounds[2];
    245     }
    246     if (bounds[5] - bounds[4] > maxBound) {
    247         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;
    248436    }
    249437
     
    276464
    277465    _streamTracer->SetInput(ds);
    278     _streamTracer->SetMaximumPropagation(maxBound);
     466    _streamTracer->SetMaximumPropagation(xLen + yLen + zLen);
     467    _streamTracer->SetIntegratorTypeToRungeKutta45();
     468
     469    TRACE("Setting streamlines max length to %g",
     470          _streamTracer->GetMaximumPropagation());
    279471
    280472    if (_pdMapper == NULL) {
     
    286478        _seedMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    287479        _seedMapper->SetResolveCoincidentTopologyToPolygonOffset();
     480        _seedMapper->ScalarVisibilityOff();
    288481    }
    289482
    290483    // Set up seed source object
    291     setSeedToRandomPoints(200);
     484    setSeedToFilledMesh(200);
    292485
    293486    switch (_lineType) {
     
    343536
    344537/**
    345  * \brief Use randomly distributed seed points
     538 * \brief Use points of the DataSet associated with this
     539 * Streamlines as seeds
     540 */
     541void Streamlines::setSeedToMeshPoints()
     542{
     543    setSeedToMeshPoints(_dataSet->getVtkDataSet());
     544}
     545
     546/**
     547 * \brief Use seed points randomly distributed within the cells
     548 * of the DataSet associated with this Streamlines
    346549 *
    347550 * Note: The current implementation doesn't give a uniform
     
    351554 * \param[in] numPoints Number of random seed points to generate
    352555 */
    353 void Streamlines::setSeedToRandomPoints(int numPoints)
     556void Streamlines::setSeedToFilledMesh(int numPoints)
     557{
     558    setSeedToFilledMesh(_dataSet->getVtkDataSet(), numPoints);
     559}
     560
     561/**
     562 * \brief Use points of a supplied vtkDataSet as seeds
     563 *
     564 * \param[in] seed vtkDataSet with points to use as seeds
     565 */
     566void Streamlines::setSeedToMeshPoints(vtkDataSet *seed)
     567{
     568    if (_streamTracer != NULL) {
     569        TRACE("Seed points: %d", seed->GetNumberOfPoints());
     570        vtkSmartPointer<vtkDataSet> oldSeed;
     571        if (_streamTracer->GetSource() != NULL) {
     572            oldSeed = _streamTracer->GetSource();
     573        }
     574
     575        _streamTracer->SetSource(seed);
     576        if (oldSeed != NULL) {
     577            oldSeed->SetPipelineInformation(NULL);
     578        }
     579
     580        if (vtkPolyData::SafeDownCast(seed) != NULL) {
     581            _seedMapper->SetInput(vtkPolyData::SafeDownCast(seed));
     582        } else {
     583            vtkSmartPointer<vtkVertexGlyphFilter> vertFilter = vtkSmartPointer<vtkVertexGlyphFilter>::New();
     584            vertFilter->SetInput(seed);
     585            _seedMapper->SetInputConnection(vertFilter->GetOutputPort());
     586        }
     587    }
     588}
     589
     590/**
     591 * \brief Use seed points randomly distributed within the cells
     592 * of a supplied vtkDataSet
     593 *
     594 * Note: The current implementation doesn't give a uniform
     595 * distribution of points, and points outside the mesh bounds
     596 * may be generated
     597 *
     598 * \param[in] ds vtkDataSet containing cells
     599 * \param[in] numPoints Number of random seed points to generate
     600 */
     601void Streamlines::setSeedToFilledMesh(vtkDataSet *ds, int numPoints)
    354602{
    355603    if (_streamTracer != NULL) {
     
    359607        vtkSmartPointer<vtkCellArray> cells = vtkSmartPointer<vtkCellArray>::New();
    360608
     609        if (ds->GetNumberOfCells() < 1) {
     610            ERROR("No cells in mesh");
     611        }
     612
    361613        for (int i = 0; i < numPoints; i++) {
    362614            double pt[3];
    363             getRandomCellPt(pt, _dataSet->getVtkDataSet());
    364             TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]);
     615            getRandomCellPt(pt, ds);
     616            //TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]);
    365617            pts->InsertNextPoint(pt);
    366618            cells->InsertNextCell(1);
     
    415667                pt[ii] = start[ii] + dir[ii] * ((double)i / (numPoints-1));
    416668            }
    417             TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]);
     669            //TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]);
    418670            pts->InsertNextPoint(pt);
    419671            polyline->GetPointIds()->SetId(i, i);
     
    507759                pt[i] = center[i] + r * (px[i] * cos(angle) + py[i] * sin(angle));
    508760            }
    509             TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]);
     761            //TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]);
    510762            pts->InsertNextPoint(pt);
    511763            cells->InsertNextCell(1);
     
    662914                                                    py[i] * sin(theta));
    663915            }
    664             TRACE("Vert %d: %g %g %g", j, verts[j][0], verts[j][1], verts[j][2]);
     916            //TRACE("Vert %d: %g %g %g", j, verts[j][0], verts[j][1], verts[j][2]);
    665917        }
    666918
     
    671923                double pt[3];
    672924                getRandomPointInTriangle(pt, verts[0], verts[1], verts[2]);
    673                 TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]);
     925                //TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]);
    674926                pts->InsertNextPoint(pt);
    675927                cells->InsertNextCell(1);
     
    682934                double pt[3];
    683935                getRandomPointInTriangle(pt, center, verts[tri], verts[(tri+1) % numSides]);
    684                 TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]);
     936                //TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]);
    685937                pts->InsertNextPoint(pt);
    686938                cells->InsertNextCell(1);
     
    708960
    709961/**
    710  * \brief Set maximum length of stream lines in world coordinates
     962 * \brief Set the integration method used
     963 */
     964void Streamlines::setIntegrator(IntegratorType integrator)
     965{
     966    if (_streamTracer != NULL) {
     967        switch (integrator) {
     968        case RUNGE_KUTTA2:
     969            _streamTracer->SetIntegratorTypeToRungeKutta2();
     970            break;
     971        case RUNGE_KUTTA4:
     972            _streamTracer->SetIntegratorTypeToRungeKutta4();
     973            break;
     974        case RUNGE_KUTTA45:
     975            _streamTracer->SetIntegratorTypeToRungeKutta45();
     976            break;
     977        default:
     978            ;
     979        }
     980    }
     981}
     982
     983/**
     984 * \brief Set the direction of integration
     985 */
     986void Streamlines::setIntegrationDirection(IntegrationDirection dir)
     987{
     988    if (_streamTracer != NULL) {
     989        switch (dir) {
     990        case FORWARD:
     991            _streamTracer->SetIntegrationDirectionToForward();
     992            break;
     993        case BACKWARD:
     994            _streamTracer->SetIntegrationDirectionToBackward();
     995            break;
     996        case BOTH:
     997            _streamTracer->SetIntegrationDirectionToBoth();
     998            break;
     999        default:
     1000            ;
     1001        }
     1002    }
     1003}
     1004
     1005/**
     1006 * \brief Set the step size units.  Length units are world
     1007 * coordinates, and cell units means steps are from cell to
     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.
     1014 */
     1015void Streamlines::setIntegrationStepUnit(StepUnit unit)
     1016{
     1017    if (_streamTracer != NULL) {
     1018        switch (unit) {
     1019        case LENGTH_UNIT:
     1020            _streamTracer->SetIntegrationStepUnit(vtkStreamTracer::LENGTH_UNIT);
     1021            break;
     1022        case CELL_LENGTH_UNIT:
     1023            _streamTracer->SetIntegrationStepUnit(vtkStreamTracer::CELL_LENGTH_UNIT);
     1024            break;
     1025        default:
     1026            ;
     1027        }
     1028    }
     1029}
     1030
     1031/**
     1032 * \brief Set initial step size for adaptive step integrator in
     1033 * step units (see setIntegrationStepUnit).  For non-adaptive
     1034 * integrators, this is the fixed step size.
     1035 */
     1036void Streamlines::setInitialIntegrationStep(double step)
     1037{
     1038    if (_streamTracer != NULL) {
     1039        _streamTracer->SetInitialIntegrationStep(step);
     1040    }
     1041}
     1042
     1043/**
     1044 * \brief Set minimum step for adaptive step integrator in
     1045 * step units (see setIntegrationStepUnit)
     1046 */
     1047void Streamlines::setMinimumIntegrationStep(double step)
     1048{
     1049    if (_streamTracer != NULL) {
     1050        _streamTracer->SetMinimumIntegrationStep(step);
     1051    }
     1052}
     1053
     1054/**
     1055 * \brief Set maximum step for adaptive step integrator in
     1056 * step units (see setIntegrationStepUnit)
     1057 */
     1058void Streamlines::setMaximumIntegrationStep(double step)
     1059{
     1060    if (_streamTracer != NULL) {
     1061        _streamTracer->SetMaximumIntegrationStep(step);
     1062    }
     1063}
     1064
     1065/**
     1066 * \brief Set maximum error tolerance
     1067 */
     1068void Streamlines::setMaximumError(double error)
     1069{
     1070    if (_streamTracer != NULL) {
     1071        _streamTracer->SetMaximumError(error);
     1072    }
     1073}
     1074
     1075/**
     1076 * \brief Set maximum length of stream lines in world
     1077 * coordinates
    7111078 */
    7121079void Streamlines::setMaxPropagation(double length)
     
    7141081    if (_streamTracer != NULL) {
    7151082        _streamTracer->SetMaximumPropagation(length);
     1083    }
     1084}
     1085
     1086/**
     1087 * \brief Set maximum number of integration steps
     1088 */
     1089void Streamlines::setMaxNumberOfSteps(int steps)
     1090{
     1091    if (_streamTracer != NULL) {
     1092        _streamTracer->SetMaximumNumberOfSteps(steps);
     1093    }
     1094}
     1095
     1096/**
     1097 * \brief Set the minimum speed before integration stops
     1098 */
     1099void Streamlines::setTerminalSpeed(double speed)
     1100{
     1101    if (_streamTracer != NULL) {
     1102        _streamTracer->SetTerminalSpeed(speed);
    7161103    }
    7171104}
     
    8201207        return;
    8211208
    822     vtkDataSet *ds = _dataSet->getVtkDataSet();
    823 
    8241209    switch (mode) {
    8251210    case COLOR_BY_SCALAR: {
     
    8341219        _pdMapper->ScalarVisibilityOn();
    8351220        _pdMapper->SetScalarModeToUsePointFieldData();
    836         if (ds->GetPointData() != NULL &&
    837             ds->GetPointData()->GetVectors() != NULL) {
    838             _pdMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName());
    839         }
     1221        _pdMapper->SelectColorArray(_dataSet->getActiveVectorsName());
    8401222        if (_lut != NULL) {
    8411223            _lut->SetRange(_vectorMagnitudeRange);
     
    8471229        _pdMapper->ScalarVisibilityOn();
    8481230        _pdMapper->SetScalarModeToUsePointFieldData();
    849         if (ds->GetPointData() != NULL &&
    850             ds->GetPointData()->GetVectors() != NULL) {
    851             _pdMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName());
    852         }
     1231        _pdMapper->SelectColorArray(_dataSet->getActiveVectorsName());
    8531232        if (_lut != NULL) {
    8541233            _lut->SetRange(_vectorComponentRange[0]);
     
    8601239        _pdMapper->ScalarVisibilityOn();
    8611240        _pdMapper->SetScalarModeToUsePointFieldData();
    862         if (ds->GetPointData() != NULL &&
    863             ds->GetPointData()->GetVectors() != NULL) {
    864             _pdMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName());
    865         }
     1241        _pdMapper->SelectColorArray(_dataSet->getActiveVectorsName());
    8661242        if (_lut != NULL) {
    8671243            _lut->SetRange(_vectorComponentRange[1]);
     
    8731249        _pdMapper->ScalarVisibilityOn();
    8741250        _pdMapper->SetScalarModeToUsePointFieldData();
    875         if (ds->GetPointData() != NULL &&
    876             ds->GetPointData()->GetVectors() != NULL) {
    877             _pdMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName());
    878         }
     1251        _pdMapper->SelectColorArray(_dataSet->getActiveVectorsName());
    8791252        if (_lut != NULL) {
    8801253            _lut->SetRange(_vectorComponentRange[2]);
     
    10581431    _seedColor[1] = color[1];
    10591432    _seedColor[2] = color[2];
    1060     if (_seedActor != NULL)
     1433    if (_seedActor != NULL) {
    10611434        _seedActor->GetProperty()->SetColor(_seedColor[0], _seedColor[1], _seedColor[2]);
     1435        _seedActor->GetProperty()->SetEdgeColor(_seedColor[0], _seedColor[1], _seedColor[2]);
     1436    }
    10621437}
    10631438
  • branches/vtkvis_threaded/RpStreamlines.h

    r2454 r2523  
    4444        COLOR_CONSTANT
    4545    };
     46    enum StepUnit {
     47        LENGTH_UNIT,
     48        CELL_LENGTH_UNIT
     49    };
     50    enum IntegratorType {
     51        RUNGE_KUTTA2,
     52        RUNGE_KUTTA4,
     53        RUNGE_KUTTA45
     54    };
     55    enum IntegrationDirection {
     56        FORWARD,
     57        BACKWARD,
     58        BOTH
     59    };
    4660
    4761    Streamlines();
     
    7791    virtual void setClippingPlanes(vtkPlaneCollection *planes);
    7892
    79     void setSeedToRandomPoints(int numPoints);
     93    void setSeedToMeshPoints();
     94
     95    void setSeedToFilledMesh(int numPoints);
     96
     97    void setSeedToMeshPoints(vtkDataSet *ds);
     98
     99    void setSeedToFilledMesh(vtkDataSet *ds, int numPoints);
    80100
    81101    void setSeedToRake(double start[3], double end[3], int numPoints);
     
    92112                                int numSides, int numPoints);
    93113
     114    void setIntegrator(IntegratorType integrator);
     115
     116    void setIntegrationDirection(IntegrationDirection dir);
     117
     118    void setIntegrationStepUnit(StepUnit unit);
     119
     120    void setInitialIntegrationStep(double step);
     121
     122    void setMinimumIntegrationStep(double step);
     123
     124    void setMaximumIntegrationStep(double step);
     125
     126    void setMaximumError(double error);
     127
    94128    void setMaxPropagation(double length);
     129
     130    void setMaxNumberOfSteps(int steps);
     131
     132    void setTerminalSpeed(double speed);
    95133
    96134    void setLineTypeToLines();
     
    130168    static void getRandomPoint(double pt[3], const double bounds[6]);
    131169    static void getRandomPointInTriangle(double pt[3],
     170                                         const double v0[3],
    132171                                         const double v1[3],
    133                                          const double v2[3],
    134                                          const double v3[3]);
     172                                         const double v2[3]);
    135173    static void getRandomPointOnLineSegment(double pt[3],
    136174                                            const double endpt[3],
    137175                                            const double endpt2[3]);
     176    static void getRandomPointInTetrahedron(double pt[3],
     177                                            const double v0[3],
     178                                            const double v1[3],
     179                                            const double v2[3],
     180                                            const double v3[3]);
    138181    static void getRandomCellPt(double pt[3], vtkDataSet *ds);
    139182
  • branches/vtkvis_threaded/RpVtkRenderServer.h

    r2100 r2523  
    99#define __RAPPTURE_VTKVIS_RENDERSERVER_H__
    1010
    11 #include "RpVtkRenderer.h"
    12 
    1311namespace Rappture {
    1412namespace VtkVis {
     13
     14class Renderer;
    1515
    1616extern int g_fdIn;
  • branches/vtkvis_threaded/RpVtkRenderer.cpp

    r2496 r2523  
    158158    }
    159159    _contour3Ds.clear();
     160    TRACE("Deleting Cutplanes");
     161    for (CutplaneHashmap::iterator itr = _cutplanes.begin();
     162             itr != _cutplanes.end(); ++itr) {
     163        delete itr->second;
     164    }
     165    _cutplanes.clear();
    160166    TRACE("Deleting Glyphs");
    161167    for (GlyphsHashmap::iterator itr = _glyphs.begin();
     
    314320
    315321/**
     322 * \brief Remove the Cutplane for the specified DataSet
     323 *
     324 * The underlying Cutplane is deleted, freeing its memory
     325 */
     326void Renderer::deleteCutplane(const DataSetId& id)
     327{
     328    CutplaneHashmap::iterator itr;
     329
     330    bool doAll = false;
     331
     332    if (id.compare("all") == 0) {
     333        itr = _cutplanes.begin();
     334        doAll = true;
     335    } else {
     336        itr = _cutplanes.find(id);
     337    }
     338    if (itr == _cutplanes.end()) {
     339        ERROR("Cutplane not found: %s", id.c_str());
     340        return;
     341    }
     342
     343    TRACE("Deleting Cutplanes for %s", id.c_str());
     344
     345    do {
     346        Cutplane *cutplane = itr->second;
     347        if (cutplane->getProp())
     348            _renderer->RemoveViewProp(cutplane->getProp());
     349        delete cutplane;
     350
     351        itr = _cutplanes.erase(itr);
     352    } while (doAll && itr != _cutplanes.end());
     353
     354    _renderer->ResetCameraClippingRange();
     355    _needsRedraw = true;
     356}
     357
     358/**
    316359 * \brief Remove the Glyphs for the specified DataSet
    317360 *
     
    637680        deleteContour2D(itr->second->getName());
    638681        deleteContour3D(itr->second->getName());
     682        deleteCutplane(itr->second->getName());
    639683        deleteGlyphs(itr->second->getName());
    640684        deleteHeightMap(itr->second->getName());
     
    858902    // Don't offset labels at origin
    859903    _cubeAxesActor->SetCornerOffset(0);
    860     _cubeAxesActor->SetFlyModeToClosestTriad();
     904    _cubeAxesActor->SetFlyModeToStaticTriad();
    861905
    862906#ifdef USE_CUSTOM_AXES
     
    12131257        }
    12141258    }
     1259    for (CutplaneHashmap::iterator itr = _cutplanes.begin();
     1260         itr != _cutplanes.end(); ++itr) {
     1261        if (itr->second->getColorMap() == cmap) {
     1262            itr->second->updateColorMap();
     1263            _needsRedraw = true;
     1264        }
     1265    }
    12151266    for (GlyphsHashmap::iterator itr = _glyphs.begin();
    12161267         itr != _glyphs.end(); ++itr) {
     
    12711322    for (Contour3DHashmap::iterator itr = _contour3Ds.begin();
    12721323         itr != _contour3Ds.end(); ++itr) {
     1324        if (itr->second->getColorMap() == cmap)
     1325            return true;
     1326    }
     1327    for (CutplaneHashmap::iterator itr = _cutplanes.begin();
     1328         itr != _cutplanes.end(); ++itr) {
    12731329        if (itr->second->getColorMap() == cmap)
    12741330            return true;
     
    21972253    } while (doAll && ++itr != _dataSets.end());
    21982254
    2199     if (_cameraMode == IMAGE)
    2200         setCameraMode(PERSPECTIVE);
    22012255    initCamera();
    22022256    _needsRedraw = true;
     
    26722726
    26732727/**
     2728 * \brief Create a new Cutplane and associate it with the named DataSet
     2729 */
     2730bool Renderer::addCutplane(const DataSetId& id)
     2731{
     2732    DataSetHashmap::iterator itr;
     2733
     2734    bool doAll = false;
     2735
     2736    if (id.compare("all") == 0) {
     2737        itr = _dataSets.begin();
     2738    } else {
     2739        itr = _dataSets.find(id);
     2740    }
     2741    if (itr == _dataSets.end()) {
     2742        ERROR("Unknown dataset %s", id.c_str());
     2743        return false;
     2744    }
     2745
     2746    do {
     2747        DataSet *ds = itr->second;
     2748        const DataSetId& dsID = ds->getName();
     2749
     2750        if (getCutplane(dsID)) {
     2751            WARN("Replacing existing Cutplane %s", dsID.c_str());
     2752            deleteCutplane(dsID);
     2753        }
     2754
     2755        Cutplane *cutplane = new Cutplane();
     2756        _cutplanes[dsID] = cutplane;
     2757
     2758        cutplane->setDataSet(ds,
     2759                             _useCumulativeRange,
     2760                             _cumulativeScalarRange,
     2761                             _cumulativeVectorMagnitudeRange,
     2762                             _cumulativeVectorComponentRange);
     2763
     2764        _renderer->AddViewProp(cutplane->getProp());
     2765    } while (doAll && ++itr != _dataSets.end());
     2766
     2767    _needsRedraw = true;
     2768    return true;
     2769}
     2770
     2771/**
     2772 * \brief Get the Cutplane associated with a named DataSet
     2773 */
     2774Cutplane *Renderer::getCutplane(const DataSetId& id)
     2775{
     2776    CutplaneHashmap::iterator itr = _cutplanes.find(id);
     2777
     2778    if (itr == _cutplanes.end()) {
     2779#ifdef DEBUG
     2780        TRACE("Cutplane not found: %s", id.c_str());
     2781#endif
     2782        return NULL;
     2783    } else
     2784        return itr->second;
     2785}
     2786
     2787/**
     2788 * \brief Set an additional transform on the prop
     2789 */
     2790void Renderer::setCutplaneTransform(const DataSetId& id, vtkMatrix4x4 *trans)
     2791{
     2792    CutplaneHashmap::iterator itr;
     2793
     2794    bool doAll = false;
     2795
     2796    if (id.compare("all") == 0) {
     2797        itr = _cutplanes.begin();
     2798        doAll = true;
     2799    } else {
     2800        itr = _cutplanes.find(id);
     2801    }
     2802    if (itr == _cutplanes.end()) {
     2803        ERROR("Cutplane not found: %s", id.c_str());
     2804        return;
     2805    }
     2806
     2807    do {
     2808        itr->second->setTransform(trans);
     2809    } while (doAll && ++itr != _cutplanes.end());
     2810
     2811    resetAxes();
     2812    _needsRedraw = true;
     2813}
     2814
     2815/**
     2816 * \brief Set the prop orientation with a quaternion
     2817 */
     2818void Renderer::setCutplaneOrientation(const DataSetId& id, double quat[4])
     2819{
     2820    CutplaneHashmap::iterator itr;
     2821
     2822    bool doAll = false;
     2823
     2824    if (id.compare("all") == 0) {
     2825        itr = _cutplanes.begin();
     2826        doAll = true;
     2827    } else {
     2828        itr = _cutplanes.find(id);
     2829    }
     2830    if (itr == _cutplanes.end()) {
     2831        ERROR("Cutplane not found: %s", id.c_str());
     2832        return;
     2833    }
     2834
     2835    do {
     2836        itr->second->setOrientation(quat);
     2837    } while (doAll && ++itr != _cutplanes.end());
     2838
     2839    resetAxes();
     2840    _needsRedraw = true;
     2841}
     2842
     2843/**
     2844 * \brief Set the prop orientation with a rotation about an axis
     2845 */
     2846void Renderer::setCutplaneOrientation(const DataSetId& id, double angle, double axis[3])
     2847{
     2848    CutplaneHashmap::iterator itr;
     2849
     2850    bool doAll = false;
     2851
     2852    if (id.compare("all") == 0) {
     2853        itr = _cutplanes.begin();
     2854        doAll = true;
     2855    } else {
     2856        itr = _cutplanes.find(id);
     2857    }
     2858    if (itr == _cutplanes.end()) {
     2859        ERROR("Cutplane not found: %s", id.c_str());
     2860        return;
     2861    }
     2862
     2863    do {
     2864        itr->second->setOrientation(angle, axis);
     2865    } while (doAll && ++itr != _cutplanes.end());
     2866
     2867    resetAxes();
     2868    _needsRedraw = true;
     2869}
     2870
     2871/**
     2872 * \brief Set the prop position in world coords
     2873 */
     2874void Renderer::setCutplanePosition(const DataSetId& id, double pos[3])
     2875{
     2876    CutplaneHashmap::iterator itr;
     2877
     2878    bool doAll = false;
     2879
     2880    if (id.compare("all") == 0) {
     2881        itr = _cutplanes.begin();
     2882        doAll = true;
     2883    } else {
     2884        itr = _cutplanes.find(id);
     2885    }
     2886    if (itr == _cutplanes.end()) {
     2887        ERROR("Cutplane not found: %s", id.c_str());
     2888        return;
     2889    }
     2890
     2891    do {
     2892        itr->second->setPosition(pos);
     2893    } while (doAll && ++itr != _cutplanes.end());
     2894
     2895    resetAxes();
     2896    _needsRedraw = true;
     2897}
     2898
     2899/**
     2900 * \brief Set the prop scaling
     2901 */
     2902void Renderer::setCutplaneScale(const DataSetId& id, double scale[3])
     2903{
     2904    CutplaneHashmap::iterator itr;
     2905
     2906    bool doAll = false;
     2907
     2908    if (id.compare("all") == 0) {
     2909        itr = _cutplanes.begin();
     2910        doAll = true;
     2911    } else {
     2912        itr = _cutplanes.find(id);
     2913    }
     2914    if (itr == _cutplanes.end()) {
     2915        ERROR("Cutplane not found: %s", id.c_str());
     2916        return;
     2917    }
     2918
     2919    do {
     2920        itr->second->setScale(scale);
     2921    } while (doAll && ++itr != _cutplanes.end());
     2922
     2923    resetAxes();
     2924    _needsRedraw = true;
     2925}
     2926
     2927/**
     2928 * \brief Set the volume slice used for mapping volumetric data
     2929 */
     2930void Renderer::setCutplaneVolumeSlice(const DataSetId& id, Cutplane::Axis axis, double ratio)
     2931{
     2932    CutplaneHashmap::iterator itr;
     2933
     2934    bool doAll = false;
     2935
     2936    if (id.compare("all") == 0) {
     2937        itr = _cutplanes.begin();
     2938        doAll = true;
     2939    } else {
     2940        itr = _cutplanes.find(id);
     2941    }
     2942
     2943    if (itr == _cutplanes.end()) {
     2944        ERROR("Cutplane not found: %s", id.c_str());
     2945        return;
     2946    }
     2947
     2948    do {
     2949        itr->second->selectVolumeSlice(axis, ratio);
     2950     } while (doAll && ++itr != _cutplanes.end());
     2951
     2952    _renderer->ResetCameraClippingRange();
     2953    _needsRedraw = true;
     2954}
     2955
     2956/**
     2957 * \brief Associate an existing named color map with a Cutplane for the given DataSet
     2958 */
     2959void Renderer::setCutplaneColorMap(const DataSetId& id, const ColorMapId& colorMapId)
     2960{
     2961    CutplaneHashmap::iterator itr;
     2962
     2963    bool doAll = false;
     2964
     2965    if (id.compare("all") == 0) {
     2966        itr = _cutplanes.begin();
     2967        doAll = true;
     2968    } else {
     2969        itr = _cutplanes.find(id);
     2970    }
     2971
     2972    if (itr == _cutplanes.end()) {
     2973        ERROR("Cutplane not found: %s", id.c_str());
     2974        return;
     2975    }
     2976
     2977    ColorMap *cmap = getColorMap(colorMapId);
     2978    if (cmap == NULL) {
     2979        ERROR("Unknown colormap: %s", colorMapId.c_str());
     2980        return;
     2981    }
     2982
     2983    do {
     2984        TRACE("Set Cutplane color map: %s for dataset %s", colorMapId.c_str(),
     2985              itr->second->getDataSet()->getName().c_str());
     2986
     2987        itr->second->setColorMap(cmap);
     2988    } while (doAll && ++itr != _cutplanes.end());
     2989
     2990    _needsRedraw = true;
     2991}
     2992
     2993/**
     2994 * \brief Set the color mode for the specified DataSet
     2995 */
     2996void Renderer::setCutplaneColorMode(const DataSetId& id, Cutplane::ColorMode mode)
     2997{
     2998    CutplaneHashmap::iterator itr;
     2999
     3000    bool doAll = false;
     3001
     3002    if (id.compare("all") == 0) {
     3003        itr = _cutplanes.begin();
     3004        doAll = true;
     3005    } else {
     3006        itr = _cutplanes.find(id);
     3007    }
     3008    if (itr == _cutplanes.end()) {
     3009        ERROR("Cutplane not found: %s", id.c_str());
     3010        return;
     3011    }
     3012
     3013    do {
     3014        itr->second->setColorMode(mode);
     3015    } while (doAll && ++itr != _cutplanes.end());
     3016
     3017    _needsRedraw = true;
     3018}
     3019
     3020/**
     3021 * \brief Set opacity of height map for the given DataSet
     3022 */
     3023void Renderer::setCutplaneOpacity(const DataSetId& id, double opacity)
     3024{
     3025    CutplaneHashmap::iterator itr;
     3026
     3027    bool doAll = false;
     3028
     3029    if (id.compare("all") == 0) {
     3030        itr = _cutplanes.begin();
     3031        doAll = true;
     3032    } else {
     3033        itr = _cutplanes.find(id);
     3034    }
     3035    if (itr == _cutplanes.end()) {
     3036        ERROR("Cutplane not found: %s", id.c_str());
     3037        return;
     3038    }
     3039
     3040    do {
     3041        itr->second->setOpacity(opacity);
     3042    } while (doAll && ++itr != _cutplanes.end());
     3043
     3044    _needsRedraw = true;
     3045}
     3046
     3047/**
     3048 * \brief Turn on/off rendering height map for the given DataSet
     3049 */
     3050void Renderer::setCutplaneVisibility(const DataSetId& id, bool state)
     3051{
     3052    CutplaneHashmap::iterator itr;
     3053
     3054    bool doAll = false;
     3055
     3056    if (id.compare("all") == 0) {
     3057        itr = _cutplanes.begin();
     3058        doAll = true;
     3059    } else {
     3060        itr = _cutplanes.find(id);
     3061    }
     3062    if (itr == _cutplanes.end()) {
     3063        ERROR("Cutplane not found: %s", id.c_str());
     3064        return;
     3065    }
     3066
     3067    do {
     3068        itr->second->setVisibility(state);
     3069    } while (doAll && ++itr != _cutplanes.end());
     3070
     3071    _needsRedraw = true;
     3072}
     3073
     3074/**
     3075 * \brief Set wireframe rendering for the specified DataSet
     3076 */
     3077void Renderer::setCutplaneWireframe(const DataSetId& id, bool state)
     3078{
     3079    CutplaneHashmap::iterator itr;
     3080
     3081    bool doAll = false;
     3082
     3083    if (id.compare("all") == 0) {
     3084        itr = _cutplanes.begin();
     3085        doAll = true;
     3086    } else {
     3087        itr = _cutplanes.find(id);
     3088    }
     3089    if (itr == _cutplanes.end()) {
     3090        ERROR("Cutplane not found: %s", id.c_str());
     3091        return;
     3092    }
     3093
     3094    do {
     3095        itr->second->setWireframe(state);
     3096    } while (doAll && ++itr != _cutplanes.end());
     3097
     3098    _needsRedraw = true;
     3099}
     3100
     3101/**
     3102 * \brief Turn on/off rendering height map mesh edges for the given DataSet
     3103 */
     3104void Renderer::setCutplaneEdgeVisibility(const DataSetId& id, bool state)
     3105{
     3106    CutplaneHashmap::iterator itr;
     3107
     3108    bool doAll = false;
     3109
     3110    if (id.compare("all") == 0) {
     3111        itr = _cutplanes.begin();
     3112        doAll = true;
     3113    } else {
     3114        itr = _cutplanes.find(id);
     3115    }
     3116    if (itr == _cutplanes.end()) {
     3117        ERROR("Cutplane not found: %s", id.c_str());
     3118        return;
     3119    }
     3120
     3121    do {
     3122        itr->second->setEdgeVisibility(state);
     3123    } while (doAll && ++itr != _cutplanes.end());
     3124
     3125    _needsRedraw = true;
     3126}
     3127
     3128/**
     3129 * \brief Set the RGB height map mesh edge color for the specified DataSet
     3130 */
     3131void Renderer::setCutplaneEdgeColor(const DataSetId& id, float color[3])
     3132{
     3133    CutplaneHashmap::iterator itr;
     3134
     3135    bool doAll = false;
     3136
     3137    if (id.compare("all") == 0) {
     3138        itr = _cutplanes.begin();
     3139        doAll = true;
     3140    } else {
     3141        itr = _cutplanes.find(id);
     3142    }
     3143    if (itr == _cutplanes.end()) {
     3144        ERROR("Cutplane not found: %s", id.c_str());
     3145        return;
     3146    }
     3147
     3148    do {
     3149        itr->second->setEdgeColor(color);
     3150    } while (doAll && ++itr != _cutplanes.end());
     3151
     3152    _needsRedraw = true;
     3153}
     3154
     3155/**
     3156 * \brief Set the height map mesh edge width for the specified DataSet (may be a no-op)
     3157 *
     3158 * If the OpenGL implementation/hardware does not support wide lines,
     3159 * this function may not have an effect.
     3160 */
     3161void Renderer::setCutplaneEdgeWidth(const DataSetId& id, float edgeWidth)
     3162{
     3163    CutplaneHashmap::iterator itr;
     3164
     3165    bool doAll = false;
     3166
     3167    if (id.compare("all") == 0) {
     3168        itr = _cutplanes.begin();
     3169        doAll = true;
     3170    } else {
     3171        itr = _cutplanes.find(id);
     3172    }
     3173    if (itr == _cutplanes.end()) {
     3174        ERROR("Cutplane not found: %s", id.c_str());
     3175        return;
     3176    }
     3177
     3178    do {
     3179        itr->second->setEdgeWidth(edgeWidth);
     3180    } while (doAll && ++itr != _cutplanes.end());
     3181
     3182    _needsRedraw = true;
     3183}
     3184
     3185/**
     3186 * \brief Turn height map lighting on/off for the specified DataSet
     3187 */
     3188void Renderer::setCutplaneLighting(const DataSetId& id, bool state)
     3189{
     3190    CutplaneHashmap::iterator itr;
     3191
     3192    bool doAll = false;
     3193
     3194    if (id.compare("all") == 0) {
     3195        itr = _cutplanes.begin();
     3196        doAll = true;
     3197    } else {
     3198        itr = _cutplanes.find(id);
     3199    }
     3200    if (itr == _cutplanes.end()) {
     3201        ERROR("Cutplane not found: %s", id.c_str());
     3202        return;
     3203    }
     3204
     3205    do {
     3206        itr->second->setLighting(state);
     3207    } while (doAll && ++itr != _cutplanes.end());
     3208    _needsRedraw = true;
     3209}
     3210
     3211/**
    26743212 * \brief Create a new Glyphs and associate it with the named DataSet
    26753213 */
     
    27173255    } while (doAll && ++itr != _dataSets.end());
    27183256
    2719     if (_cameraMode == IMAGE)
    2720         setCameraMode(PERSPECTIVE);
    27213257    initCamera();
    27223258
     
    33223858    } while (doAll && ++itr != _dataSets.end());
    33233859
    3324     if (_cameraMode == IMAGE)
    3325         setCameraMode(PERSPECTIVE);
    33263860    initCamera();
    33273861
     
    33763910    } while (doAll && ++itr != _dataSets.end());
    33773911
    3378     if (_cameraMode == IMAGE)
    3379         setCameraMode(PERSPECTIVE);
    33803912    initCamera();
    33813913
     
    35614093    }
    35624094
     4095    bool initCam = false;
    35634096    do {
    35644097        itr->second->selectVolumeSlice(axis, ratio);
     4098        if (itr->second->getHeightScale() > 0.0)
     4099            initCam = true;
    35654100     } while (doAll && ++itr != _heightMaps.end());
    35664101
    3567     initCamera();
     4102    if (initCam)
     4103        initCamera();
     4104    else
     4105        _renderer->ResetCameraClippingRange();
    35684106    _needsRedraw = true;
    35694107}
     
    40324570    } while (doAll && ++itr != _dataSets.end());
    40334571
    4034     if (_cameraMode == IMAGE)
    4035         setCameraMode(PERSPECTIVE);
    40364572    initCamera();
    40374573    _needsRedraw = true;
     
    42204756     } while (doAll && ++itr != _lics.end());
    42214757
    4222     initCamera();
     4758    _renderer->ResetCameraClippingRange();
    42234759    _needsRedraw = true;
    42244760}
     
    44624998    } while (doAll && ++itr != _dataSets.end());
    44634999
    4464     if (_cameraMode == IMAGE)
    4465         setCameraMode(PERSPECTIVE);
    44665000    initCamera();
    44675001    _needsRedraw = true;
     
    49715505    } while (doAll && ++itr != _dataSets.end());
    49725506
    4973     if (_cameraMode == IMAGE)
    4974         setCameraMode(PERSPECTIVE);
    49755507    initCamera();
    49765508    _needsRedraw = true;
     
    60736605
    60746606/**
     6607 * \brief Set the streamlines seed to points of the streamlines DataSet
     6608 */
     6609void Renderer::setStreamlinesSeedToMeshPoints(const DataSetId& id)
     6610{
     6611    StreamlinesHashmap::iterator itr;
     6612
     6613    bool doAll = false;
     6614
     6615    if (id.compare("all") == 0) {
     6616        itr = _streamlines.begin();
     6617        doAll = true;
     6618    } else {
     6619        itr = _streamlines.find(id);
     6620    }
     6621    if (itr == _streamlines.end()) {
     6622        ERROR("Streamlines not found: %s", id.c_str());
     6623        return;
     6624    }
     6625
     6626    do {
     6627        itr->second->setSeedToMeshPoints();
     6628    } while (doAll && ++itr != _streamlines.end());
     6629
     6630    _needsRedraw = true;
     6631}
     6632
     6633/**
     6634 * \brief Set the streamlines seed to points distributed randomly inside
     6635 * cells of the streamlines DataSet
     6636 */
     6637void Renderer::setStreamlinesSeedToFilledMesh(const DataSetId& id, int numPoints)
     6638{
     6639    StreamlinesHashmap::iterator itr;
     6640
     6641    bool doAll = false;
     6642
     6643    if (id.compare("all") == 0) {
     6644        itr = _streamlines.begin();
     6645        doAll = true;
     6646    } else {
     6647        itr = _streamlines.find(id);
     6648    }
     6649    if (itr == _streamlines.end()) {
     6650        ERROR("Streamlines not found: %s", id.c_str());
     6651        return;
     6652    }
     6653
     6654    do {
     6655        itr->second->setSeedToFilledMesh(numPoints);
     6656    } while (doAll && ++itr != _streamlines.end());
     6657
     6658    _needsRedraw = true;
     6659}
     6660
     6661/**
     6662 * \brief Set the streamlines seed to points of a DataSet
     6663 *
     6664 * \param[in] id DataSet identifier
     6665 * \param[in] data Bytes of VTK DataSet file
     6666 * \param[in] nbytes Length of data array
     6667 *
     6668 * \return boolean indicating success or failure
     6669 */
     6670bool Renderer::setStreamlinesSeedToMeshPoints(const DataSetId& id,
     6671                                              char *data, size_t nbytes)
     6672{
     6673    vtkSmartPointer<vtkDataSetReader> reader = vtkSmartPointer<vtkDataSetReader>::New();
     6674    vtkSmartPointer<vtkCharArray> dataSetString = vtkSmartPointer<vtkCharArray>::New();
     6675
     6676    dataSetString->SetArray(data, nbytes, 1);
     6677    reader->SetInputArray(dataSetString);
     6678    reader->ReadFromInputStringOn();
     6679    reader->Update();
     6680
     6681    vtkSmartPointer<vtkDataSet> dataSet = reader->GetOutput();
     6682    if (dataSet == NULL) {
     6683        return false;
     6684    }
     6685    dataSet->SetPipelineInformation(NULL);
     6686
     6687    StreamlinesHashmap::iterator itr;
     6688
     6689    bool doAll = false;
     6690
     6691    if (id.compare("all") == 0) {
     6692        itr = _streamlines.begin();
     6693        doAll = true;
     6694    } else {
     6695        itr = _streamlines.find(id);
     6696    }
     6697    if (itr == _streamlines.end()) {
     6698        ERROR("Streamlines not found: %s", id.c_str());
     6699        return false;
     6700    }
     6701
     6702    do {
     6703        itr->second->setSeedToMeshPoints(dataSet);
     6704    } while (doAll && ++itr != _streamlines.end());
     6705
     6706    _needsRedraw = true;
     6707    return true;
     6708}
     6709
     6710/**
    60756711 * \brief Set the streamlines seed to points distributed randomly inside
    60766712 * cells of DataSet
    6077  */
    6078 void Renderer::setStreamlinesSeedToRandomPoints(const DataSetId& id, int numPoints)
    6079 {
     6713 *
     6714 * \param[in] id DataSet identifier
     6715 * \param[in] data Bytes of VTK DataSet file
     6716 * \param[in] nbytes Length of data array
     6717 * \param[in] numPoints Number of random seed points to generate
     6718 *
     6719 * \return boolean indicating success or failure
     6720 */
     6721bool Renderer::setStreamlinesSeedToFilledMesh(const DataSetId& id,
     6722                                              char *data, size_t nbytes,
     6723                                              int numPoints)
     6724{
     6725    vtkSmartPointer<vtkDataSetReader> reader = vtkSmartPointer<vtkDataSetReader>::New();
     6726    vtkSmartPointer<vtkCharArray> dataSetString = vtkSmartPointer<vtkCharArray>::New();
     6727
     6728    dataSetString->SetArray(data, nbytes, 1);
     6729    reader->SetInputArray(dataSetString);
     6730    reader->ReadFromInputStringOn();
     6731    reader->Update();
     6732
     6733    vtkSmartPointer<vtkDataSet> dataSet = reader->GetOutput();
     6734    if (dataSet == NULL) {
     6735        return false;
     6736    }
     6737    dataSet->SetPipelineInformation(NULL);
     6738
    60806739    StreamlinesHashmap::iterator itr;
    60816740
     
    60906749    if (itr == _streamlines.end()) {
    60916750        ERROR("Streamlines not found: %s", id.c_str());
    6092         return;
    6093     }
    6094 
    6095     do {
    6096         itr->second->setSeedToRandomPoints(numPoints);
     6751        return false;
     6752    }
     6753
     6754    do {
     6755        itr->second->setSeedToFilledMesh(dataSet, numPoints);
    60976756    } while (doAll && ++itr != _streamlines.end());
    60986757
    60996758    _needsRedraw = true;
     6759    return true;
    61006760}
    61016761
     
    66817341    } while (doAll && ++itr != _dataSets.end());
    66827342
    6683     if (_cameraMode == IMAGE)
    6684         setCameraMode(PERSPECTIVE);
    66857343    initCamera();
    66867344    _needsRedraw = true;
     
    74168074            _cameraOrientation[3] = 0.0;
    74178075        }
    7418         setViewAngle(_windowHeight);
     8076        //setViewAngle(_windowHeight);
    74198077        double bounds[6];
    74208078        collectBounds(bounds, false);
     
    79528610            mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds());
    79538611    }
     8612    for (CutplaneHashmap::iterator itr = _cutplanes.begin();
     8613             itr != _cutplanes.end(); ++itr) {
     8614        if ((!onlyVisible || itr->second->getVisibility()) &&
     8615            itr->second->getProp() != NULL)
     8616            mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds());
     8617    }
    79548618    for (GlyphsHashmap::iterator itr = _glyphs.begin();
    79558619             itr != _glyphs.end(); ++itr) {
     
    80488712    for (Contour3DHashmap::iterator itr = _contour3Ds.begin();
    80498713         itr != _contour3Ds.end(); ++itr) {
     8714        itr->second->updateRanges(_useCumulativeRange,
     8715                                  _cumulativeScalarRange,
     8716                                  _cumulativeVectorMagnitudeRange,
     8717                                  _cumulativeVectorComponentRange);
     8718    }
     8719    for (CutplaneHashmap::iterator itr = _cutplanes.begin();
     8720         itr != _cutplanes.end(); ++itr) {
    80508721        itr->second->updateRanges(_useCumulativeRange,
    80518722                                  _cumulativeScalarRange,
     
    83839054    if (id.compare("all") == 0 || getContour3D(id) != NULL)
    83849055        setContour3DOpacity(id, opacity);
     9056    if (id.compare("all") == 0 || getCutplane(id) != NULL)
     9057        setCutplaneOpacity(id, opacity);
    83859058    if (id.compare("all") == 0 || getGlyphs(id) != NULL)
    83869059        setGlyphsOpacity(id, opacity);
     
    84319104    if (id.compare("all") == 0 || getContour3D(id) != NULL)
    84329105        setContour3DVisibility(id, state);
     9106   if (id.compare("all") == 0 || getCutplane(id) != NULL)
     9107        setCutplaneVisibility(id, state);
    84339108    if (id.compare("all") == 0 || getGlyphs(id) != NULL)
    84349109        setGlyphsVisibility(id, state);
     
    85379212            }
    85389213        } else {
    8539             if (ratio > 0.0) {
     9214            if (ratio < 1.0) {
    85409215                if (_userClipPlanes[1] == NULL) {
    85419216                    _userClipPlanes[1] = vtkSmartPointer<vtkPlane>::New();
     
    85609235            }
    85619236        } else {
    8562             if (ratio > 0.0) {
     9237            if (ratio < 1.0) {
    85639238                if (_userClipPlanes[3] == NULL) {
    85649239                    _userClipPlanes[3] = vtkSmartPointer<vtkPlane>::New();
     
    85839258            }
    85849259        } else {
    8585             if (ratio > 0.0) {
     9260            if (ratio < 1.0) {
    85869261                if (_userClipPlanes[5] == NULL) {
    85879262                    _userClipPlanes[5] = vtkSmartPointer<vtkPlane>::New();
     
    86399314        itr->second->setClippingPlanes(_activeClipPlanes);
    86409315    }
     9316    for (CutplaneHashmap::iterator itr = _cutplanes.begin();
     9317         itr != _cutplanes.end(); ++itr) {
     9318        itr->second->setClippingPlanes(_activeClipPlanes);
     9319    }
    86419320    for (GlyphsHashmap::iterator itr = _glyphs.begin();
    86429321         itr != _glyphs.end(); ++itr) {
  • branches/vtkvis_threaded/RpVtkRenderer.h

    r2496 r2523  
    2929#include "RpContour2D.h"
    3030#include "RpContour3D.h"
     31#include "RpCutplane.h"
    3132#include "RpGlyphs.h"
    3233#include "RpHeightMap.h"
     
    101102    typedef std::tr1::unordered_map<DataSetId, Contour2D *> Contour2DHashmap;
    102103    typedef std::tr1::unordered_map<DataSetId, Contour3D *> Contour3DHashmap;
     104    typedef std::tr1::unordered_map<DataSetId, Cutplane *> CutplaneHashmap;
    103105    typedef std::tr1::unordered_map<DataSetId, Glyphs *> GlyphsHashmap;
    104106    typedef std::tr1::unordered_map<DataSetId, HeightMap *> HeightMapHashmap;
     
    164166    void setViewAngle(int height);
    165167
     168    vtkCamera *getVtkCamera()
     169    {
     170        if (_renderer != NULL)
     171            return _renderer->GetActiveCamera();
     172        else
     173            return NULL;
     174    }
     175
    166176    void setCameraMode(CameraMode mode);
    167177
     
    333343    void setContour3DColorMap(const DataSetId& id, const ColorMapId& colorMapId);
    334344
     345    // Cutplanes
     346
     347    bool addCutplane(const DataSetId& id);
     348   
     349    void deleteCutplane(const DataSetId& id);
     350
     351    Cutplane *getCutplane(const DataSetId& id);
     352
     353    void setCutplaneTransform(const DataSetId& id, vtkMatrix4x4 *trans);
     354
     355    void setCutplaneOrientation(const DataSetId& id, double quat[4]);
     356
     357    void setCutplaneOrientation(const DataSetId& id, double angle, double axis[3]);
     358
     359    void setCutplanePosition(const DataSetId& id, double pos[3]);
     360
     361    void setCutplaneScale(const DataSetId& id, double scale[3]);
     362
     363    void setCutplaneEdgeVisibility(const DataSetId& id, bool state);
     364
     365    void setCutplaneEdgeColor(const DataSetId& id, float color[3]);
     366
     367    void setCutplaneEdgeWidth(const DataSetId& id, float edgeWidth);
     368
     369    void setCutplaneLighting(const DataSetId& id, bool state);
     370
     371    void setCutplaneOpacity(const DataSetId& id, double opacity);
     372
     373    void setCutplaneVisibility(const DataSetId& id, bool state);
     374
     375    void setCutplaneWireframe(const DataSetId& id, bool state);
     376
     377    void setCutplaneVolumeSlice(const DataSetId& id, Cutplane::Axis axis, double ratio);
     378
     379    void setCutplaneColorMap(const DataSetId& id, const ColorMapId& colorMapId);
     380
     381    void setCutplaneColorMode(const DataSetId& id, Cutplane::ColorMode mode);
     382
    335383    // Glyphs
    336384
     
    611659    void setStreamlinesVisibility(const DataSetId& id, bool state);
    612660
    613     void setStreamlinesSeedToRandomPoints(const DataSetId& id, int numPoints);
     661    void setStreamlinesSeedToMeshPoints(const DataSetId& id);
     662
     663    void setStreamlinesSeedToFilledMesh(const DataSetId& id, int numPoints);
     664
     665    bool setStreamlinesSeedToMeshPoints(const DataSetId& id,
     666                                        char *data, size_t nbytes);
     667
     668    bool setStreamlinesSeedToFilledMesh(const DataSetId& id,
     669                                        char *data, size_t nbytes,
     670                                        int numPoints);
    614671
    615672    void setStreamlinesSeedToRake(const DataSetId& id,
     
    745802    Contour2DHashmap _contour2Ds;
    746803    Contour3DHashmap _contour3Ds;
     804    CutplaneHashmap _cutplanes;
    747805    GlyphsHashmap _glyphs;
    748806    HeightMapHashmap _heightMaps;
  • branches/vtkvis_threaded/RpVtkRendererCmd.cpp

    r2500 r2523  
    2121#include "RpVtkRendererCmd.h"
    2222#include "RpVtkRenderServer.h"
     23#include "RpVtkRenderer.h"
    2324#include "PPMWriter.h"
    2425#include "TGAWriter.h"
     
    6364
    6465#endif  /*USE_THREADS*/
     66
     67static size_t
     68SocketRead(void *bytes, size_t len)
     69{
     70#ifdef notdef
     71    size_t ofs = 0;
     72    ssize_t bytesRead = 0;
     73    while ((bytesRead = read(g_fdIn, bytes + ofs, len - ofs)) > 0) {
     74        ofs += bytesRead;
     75        if (ofs == len)
     76            break;
     77    }
     78    TRACE("bytesRead: %lu", ofs);
     79    return ofs;
     80#else
     81    size_t bytesRead = fread(bytes, 1, len, g_fIn);
     82    TRACE("bytesRead: %lu", bytesRead);
     83    return bytesRead;
     84#endif
     85}
    6586
    6687static int
     
    203224{
    204225    const char *title = Tcl_GetString(objv[3]);
     226    if (strlen(title) > 30) {
     227        Tcl_AppendResult(interp, "axis name \"", title,
     228                         "\" is too long", (char*)NULL);
     229        return TCL_ERROR;
     230    }
    205231    const char *string = Tcl_GetString(objv[2]);
    206232    char c = string[0];
     
    270296{
    271297    const char *units = Tcl_GetString(objv[3]);
     298    if (strlen(units) > 10) {
     299        Tcl_AppendResult(interp, "axis units name \"", units,
     300                         "\" is too long", (char*)NULL);
     301        return TCL_ERROR;
     302    }
    272303    const char *string = Tcl_GetString(objv[2]);
    273304    char c = string[0];
     
    277308        g_renderer->setAxisUnits(Renderer::Y_AXIS, units);
    278309    } else if ((c == 'z') && (strcmp(string, "z") == 0)) {
     310        g_renderer->setAxisUnits(Renderer::Z_AXIS, units);
     311    } else if ((c == 'a') && (strcmp(string, "all") == 0)) {
     312        g_renderer->setAxisUnits(Renderer::X_AXIS, units);
     313        g_renderer->setAxisUnits(Renderer::Y_AXIS, units);
    279314        g_renderer->setAxisUnits(Renderer::Z_AXIS, units);
    280315    } else {
     
    12661301
    12671302static int
     1303CutplaneAddOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1304              Tcl_Obj *const *objv)
     1305{
     1306    if (objc == 3) {
     1307        const char *name = Tcl_GetString(objv[2]);
     1308        if (!g_renderer->addCutplane(name)) {
     1309            Tcl_AppendResult(interp, "Failed to create cutplane", (char*)NULL);
     1310            return TCL_ERROR;
     1311        }
     1312    } else {
     1313        if (!g_renderer->addCutplane("all")) {
     1314            Tcl_AppendResult(interp, "Failed to create cutplane for one or more data sets", (char*)NULL);
     1315            return TCL_ERROR;
     1316        }
     1317    }
     1318    return TCL_OK;
     1319}
     1320
     1321static int
     1322CutplaneColorMapOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1323                   Tcl_Obj *const *objv)
     1324{
     1325    const char *colorMapName = Tcl_GetString(objv[2]);
     1326    if (objc == 4) {
     1327        const char *dataSetName = Tcl_GetString(objv[3]);
     1328        g_renderer->setCutplaneColorMap(dataSetName, colorMapName);
     1329    } else {
     1330        g_renderer->setCutplaneColorMap("all", colorMapName);
     1331    }
     1332    return TCL_OK;
     1333}
     1334
     1335static int
     1336CutplaneColorModeOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1337                    Tcl_Obj *const *objv)
     1338{
     1339    Cutplane::ColorMode mode;
     1340    const char *str = Tcl_GetString(objv[2]);
     1341    if (str[0] == 's' && strcmp(str, "scalar") == 0) {
     1342        mode = Cutplane::COLOR_BY_SCALAR;
     1343    } else if (str[0] == 'v' && strcmp(str, "vmag") == 0) {
     1344        mode = Cutplane::COLOR_BY_VECTOR_MAGNITUDE;
     1345    } else if (str[0] == 'v' && strcmp(str, "vx") == 0) {
     1346        mode = Cutplane::COLOR_BY_VECTOR_X;
     1347    } else if (str[0] == 'v' && strcmp(str, "vy") == 0) {
     1348        mode = Cutplane::COLOR_BY_VECTOR_Y;
     1349    } else if (str[0] == 'v' && strcmp(str, "vz") == 0) {
     1350        mode = Cutplane::COLOR_BY_VECTOR_Z;
     1351    } else {
     1352        Tcl_AppendResult(interp, "bad color mode option \"", str,
     1353                         "\": should be one of: 'scalar', 'vmag', 'vx', 'vy', 'vz'", (char*)NULL);
     1354        return TCL_ERROR;
     1355    }
     1356    if (objc == 4) {
     1357        const char *name = Tcl_GetString(objv[3]);
     1358        g_renderer->setCutplaneColorMode(name, mode);
     1359    } else {
     1360        g_renderer->setCutplaneColorMode("all", mode);
     1361    }
     1362    return TCL_OK;
     1363}
     1364
     1365static int
     1366CutplaneDeleteOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1367                 Tcl_Obj *const *objv)
     1368{
     1369    if (objc == 3) {
     1370        const char *name = Tcl_GetString(objv[2]);
     1371        g_renderer->deleteCutplane(name);
     1372    } else {
     1373        g_renderer->deleteCutplane("all");
     1374    }
     1375    return TCL_OK;
     1376}
     1377
     1378static int
     1379CutplaneEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1380                         Tcl_Obj *const *objv)
     1381{
     1382    bool state;
     1383    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     1384        return TCL_ERROR;
     1385    }
     1386    if (objc == 4) {
     1387        const char *name = Tcl_GetString(objv[3]);
     1388        g_renderer->setCutplaneEdgeVisibility(name, state);
     1389    } else {
     1390        g_renderer->setCutplaneEdgeVisibility("all", state);
     1391    }
     1392    return TCL_OK;
     1393}
     1394
     1395static int
     1396CutplaneLightingOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1397                   Tcl_Obj *const *objv)
     1398{
     1399    bool state;
     1400    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     1401        return TCL_ERROR;
     1402    }
     1403    if (objc == 4) {
     1404        const char *name = Tcl_GetString(objv[3]);
     1405        g_renderer->setCutplaneLighting(name, state);
     1406    } else {
     1407        g_renderer->setCutplaneLighting("all", state);
     1408    }
     1409    return TCL_OK;
     1410}
     1411
     1412static int
     1413CutplaneLineColorOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1414                    Tcl_Obj *const *objv)
     1415{
     1416    float color[3];
     1417    if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||
     1418        GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK ||
     1419        GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) {
     1420        return TCL_ERROR;
     1421    }
     1422    if (objc == 6) {
     1423        const char *name = Tcl_GetString(objv[5]);
     1424        g_renderer->setCutplaneEdgeColor(name, color);
     1425    } else {
     1426        g_renderer->setCutplaneEdgeColor("all", color);
     1427    }
     1428    return TCL_OK;
     1429}
     1430
     1431static int
     1432CutplaneLineWidthOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1433                    Tcl_Obj *const *objv)
     1434{
     1435    float width;
     1436    if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) {
     1437        return TCL_ERROR;
     1438    }
     1439    if (objc == 4) {
     1440        const char *name = Tcl_GetString(objv[3]);
     1441        g_renderer->setCutplaneEdgeWidth(name, width);
     1442    } else {
     1443        g_renderer->setCutplaneEdgeWidth("all", width);
     1444    }
     1445    return TCL_OK;
     1446}
     1447
     1448static int
     1449CutplaneOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1450                  Tcl_Obj *const *objv)
     1451{
     1452    double opacity;
     1453    if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) {
     1454        return TCL_ERROR;
     1455    }
     1456    if (objc == 4) {
     1457        const char *name = Tcl_GetString(objv[3]);
     1458        g_renderer->setCutplaneOpacity(name, opacity);
     1459    } else {
     1460        g_renderer->setCutplaneOpacity("all", opacity);
     1461    }
     1462    return TCL_OK;
     1463}
     1464
     1465static int
     1466CutplaneOrientOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1467                 Tcl_Obj *const *objv)
     1468{
     1469    double quat[4];
     1470    if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK ||
     1471        Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK ||
     1472        Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK ||
     1473        Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) {
     1474        return TCL_ERROR;
     1475    }
     1476    if (objc == 7) {
     1477        const char *name = Tcl_GetString(objv[6]);
     1478        g_renderer->setCutplaneOrientation(name, quat);
     1479    } else {
     1480        g_renderer->setCutplaneOrientation("all", quat);
     1481    }
     1482    return TCL_OK;
     1483}
     1484
     1485static int
     1486CutplanePositionOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1487                   Tcl_Obj *const *objv)
     1488{
     1489    double pos[3];
     1490    if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK ||
     1491        Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK ||
     1492        Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) {
     1493        return TCL_ERROR;
     1494    }
     1495    if (objc == 6) {
     1496        const char *name = Tcl_GetString(objv[5]);
     1497        g_renderer->setCutplanePosition(name, pos);
     1498    } else {
     1499        g_renderer->setCutplanePosition("all", pos);
     1500    }
     1501    return TCL_OK;
     1502}
     1503
     1504static int
     1505CutplaneScaleOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1506                Tcl_Obj *const *objv)
     1507{
     1508    double scale[3];
     1509    if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK ||
     1510        Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK ||
     1511        Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) {
     1512        return TCL_ERROR;
     1513    }
     1514    if (objc == 6) {
     1515        const char *name = Tcl_GetString(objv[5]);
     1516        g_renderer->setCutplaneScale(name, scale);
     1517    } else {
     1518        g_renderer->setCutplaneScale("all", scale);
     1519    }
     1520    return TCL_OK;
     1521}
     1522
     1523static int
     1524CutplaneVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1525                  Tcl_Obj *const *objv)
     1526{
     1527    bool state;
     1528    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     1529        return TCL_ERROR;
     1530    }
     1531    if (objc == 4) {
     1532        const char *name = Tcl_GetString(objv[3]);
     1533        g_renderer->setCutplaneVisibility(name, state);
     1534    } else {
     1535        g_renderer->setCutplaneVisibility("all", state);
     1536    }
     1537    return TCL_OK;
     1538}
     1539
     1540static int
     1541CutplaneVolumeSliceOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1542                      Tcl_Obj *const *objv)
     1543{
     1544    double ratio;
     1545    if (Tcl_GetDoubleFromObj(interp, objv[3], &ratio) != TCL_OK) {
     1546        return TCL_ERROR;
     1547    }
     1548    const char *string = Tcl_GetString(objv[2]);
     1549    char c = string[0];
     1550    Cutplane::Axis axis;
     1551    if ((c == 'x') && (strcmp(string, "x") == 0)) {
     1552        axis = Cutplane::X_AXIS;
     1553    } else if ((c == 'y') && (strcmp(string, "y") == 0)) {
     1554        axis = Cutplane::Y_AXIS;
     1555    } else if ((c == 'z') && (strcmp(string, "z") == 0)) {
     1556        axis = Cutplane::Z_AXIS;
     1557    } else {
     1558        Tcl_AppendResult(interp, "bad axis option \"", string,
     1559                         "\": should be axisName ratio", (char*)NULL);
     1560        return TCL_ERROR;
     1561    }
     1562    if (objc == 5) {
     1563        const char *name = Tcl_GetString(objv[4]);
     1564        g_renderer->setCutplaneVolumeSlice(name, axis, ratio);
     1565    } else {
     1566        g_renderer->setCutplaneVolumeSlice("all", axis, ratio);
     1567    }
     1568    return TCL_OK;
     1569}
     1570
     1571static int
     1572CutplaneWireframeOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1573                    Tcl_Obj *const *objv)
     1574{
     1575    bool state;
     1576    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     1577        return TCL_ERROR;
     1578    }
     1579    if (objc == 4) {
     1580        const char *name = Tcl_GetString(objv[3]);
     1581        g_renderer->setCutplaneWireframe(name, state);
     1582    } else {
     1583        g_renderer->setCutplaneWireframe("all", state);
     1584    }
     1585    return TCL_OK;
     1586}
     1587
     1588static Rappture::CmdSpec cutplaneOps[] = {
     1589    {"add",          1, CutplaneAddOp, 2, 3, "oper value ?dataSetName?"},
     1590    {"colormap",     7, CutplaneColorMapOp, 3, 4, "colorMapName ?dataSetName?"},
     1591    {"colormode",    7, CutplaneColorModeOp, 3, 4, "mode ?dataSetNme?"},
     1592    {"delete",       1, CutplaneDeleteOp, 2, 3, "?dataSetName?"},
     1593    {"edges",        1, CutplaneEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"},
     1594    {"lighting",     3, CutplaneLightingOp, 3, 4, "bool ?dataSetName?"},
     1595    {"linecolor",    5, CutplaneLineColorOp, 5, 6, "r g b ?dataSetName?"},
     1596    {"linewidth",    5, CutplaneLineWidthOp, 3, 4, "width ?dataSetName?"},
     1597    {"opacity",      2, CutplaneOpacityOp, 3, 4, "value ?dataSetName?"},
     1598    {"orient",       2, CutplaneOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"},
     1599    {"pos",          1, CutplanePositionOp, 5, 6, "x y z ?dataSetName?"},
     1600    {"scale",        2, CutplaneScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
     1601    {"slice",        2, CutplaneVolumeSliceOp, 4, 5, "axis ratio ?dataSetName?"},
     1602    {"visible",      1, CutplaneVisibleOp, 3, 4, "bool ?dataSetName?"},
     1603    {"wireframe",    1, CutplaneWireframeOp, 3, 4, "bool ?dataSetName?"}
     1604};
     1605static int nCutplaneOps = NumCmdSpecs(cutplaneOps);
     1606
     1607static int
     1608CutplaneCmd(ClientData clientData, Tcl_Interp *interp, int objc,
     1609             Tcl_Obj *const *objv)
     1610{
     1611    Tcl_ObjCmdProc *proc;
     1612
     1613    proc = Rappture::GetOpFromObj(interp, nCutplaneOps, cutplaneOps,
     1614                                  Rappture::CMDSPEC_ARG1, objc, objv, 0);
     1615    if (proc == NULL) {
     1616        return TCL_ERROR;
     1617    }
     1618    return (*proc) (clientData, interp, objc, objv);
     1619}
     1620
     1621static int
    12681622DataSetActiveScalarsOp(ClientData clientData, Tcl_Interp *interp, int objc,
    12691623                       Tcl_Obj *const *objv)
     
    13341688    }
    13351689    char *data = (char *)malloc(nbytes);
    1336     size_t bytesRead = fread(data, 1, nbytes, g_fIn);
    1337     TRACE("bytesRead: %d", bytesRead);
     1690    size_t bytesRead = SocketRead(data, nbytes);
    13381691    if (bytesRead < (size_t)nbytes) {
    13391692        free(data);
     
    25892942static Rappture::CmdSpec heightmapOps[] = {
    25902943    {"add",          1, HeightMapAddOp, 5, 6, "oper value ?dataSetName?"},
    2591     {"colormap",     2, HeightMapColorMapOp, 3, 4, "colorMapName ?dataSetName?"},
    2592     {"contourlist",  2, HeightMapContourListOp, 3, 4, "contourList ?dataSetName?"},
     2944    {"colormap",     3, HeightMapColorMapOp, 3, 4, "colorMapName ?dataSetName?"},
     2945    {"contourlist",  3, HeightMapContourListOp, 3, 4, "contourList ?dataSetName?"},
    25932946    {"delete",       1, HeightMapDeleteOp, 2, 3, "?dataSetName?"},
    25942947    {"edges",        1, HeightMapEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"},
     
    26042957    {"orient",       2, HeightMapOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"},
    26052958    {"pos",          1, HeightMapPositionOp, 5, 6, "x y z ?dataSetName?"},
    2606     {"scale",        1, HeightMapScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
     2959    {"scale",        2, HeightMapScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
     2960    {"slice",        2, HeightMapVolumeSliceOp, 4, 5, "axis ratio ?dataSetName?"},
    26072961    {"surface",      2, HeightMapContourSurfaceVisibleOp, 3, 4, "bool ?dataSetName?"},
    2608     {"visible",      2, HeightMapVisibleOp, 3, 4, "bool ?dataSetName?"},
    2609     {"volumeslice",  2, HeightMapVolumeSliceOp, 4, 5, "axis ratio ?dataSetName?"},
     2962    {"visible",      1, HeightMapVisibleOp, 3, 4, "bool ?dataSetName?"},
    26102963    {"wireframe",    1, HeightMapWireframeOp, 3, 4, "bool ?dataSetName?"}
    26112964};
     
    29783331    {"orient",      2, LICOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"},
    29793332    {"pos",         1, LICPositionOp, 5, 6, "x y z ?dataSetName?"},
    2980     {"scale",       1, LICScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
    2981     {"visible",     2, LICVisibleOp, 3, 4, "bool ?dataSetName?"},
    2982     {"volumeslice", 2, LICVolumeSliceOp, 4, 5, "axis ratio ?dataSetName?"}
     3333    {"scale",       2, LICScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
     3334    {"slice",       2, LICVolumeSliceOp, 4, 5, "axis ratio ?dataSetName?"},
     3335    {"visible",     1, LICVisibleOp, 3, 4, "bool ?dataSetName?"}
    29833336};
    29843337static int nLICOps = NumCmdSpecs(licOps);
     
    43864739
    43874740static int
     4741StreamlinesSeedFilledMeshOp(ClientData clientData, Tcl_Interp *interp,
     4742                            int objc, Tcl_Obj *const *objv)
     4743{
     4744    int numPoints = 0;
     4745    if (Tcl_GetIntFromObj(interp, objv[3], &numPoints) != TCL_OK ||
     4746        numPoints < 1) {
     4747        return TCL_ERROR;
     4748    }
     4749    const char *string = Tcl_GetString(objv[4]);
     4750    char c = string[0];
     4751    if ((c != 'd') || (strcmp(string, "data") != 0)) {
     4752        Tcl_AppendResult(interp, "bad streamlines seed fmesh option \"",
     4753                         string, "\": should be data", (char*)NULL);
     4754        return TCL_ERROR;
     4755    }
     4756    string = Tcl_GetString(objv[5]);
     4757    c = string[0];
     4758    if ((c != 'f') || (strcmp(string, "follows") != 0)) {
     4759        Tcl_AppendResult(interp, "bad streamlines seed fmesh option \"",
     4760                         string, "\": should be follows", (char*)NULL);
     4761        return TCL_ERROR;
     4762    }
     4763    int nbytes = 0;
     4764    if (Tcl_GetIntFromObj(interp, objv[6], &nbytes) != TCL_OK ||
     4765        nbytes < 0) {
     4766        return TCL_ERROR;
     4767    }
     4768    char *data = (char *)malloc(nbytes);
     4769    size_t bytesRead = SocketRead(data, nbytes);
     4770    if (bytesRead < (size_t)nbytes) {
     4771        free(data);
     4772        return TCL_ERROR;
     4773    }
     4774    if (objc == 8) {
     4775        const char *name = Tcl_GetString(objv[7]);
     4776        if (!g_renderer->setStreamlinesSeedToFilledMesh(name, data, nbytes,
     4777                                                        numPoints)) {
     4778            free(data);
     4779            Tcl_AppendResult(interp, "Couldn't read mesh data or streamlines not found", (char*)NULL);
     4780            return TCL_ERROR;
     4781        }
     4782    } else {
     4783        if (!g_renderer->setStreamlinesSeedToFilledMesh("all", data, nbytes,
     4784                                                        numPoints)) {
     4785            free(data);
     4786            Tcl_AppendResult(interp, "Couldn't read mesh data or streamlines not found", (char*)NULL);
     4787            return TCL_ERROR;
     4788        }
     4789    }
     4790    free(data);
     4791    return TCL_OK;
     4792}
     4793
     4794static int
     4795StreamlinesSeedMeshPointsOp(ClientData clientData, Tcl_Interp *interp,
     4796                            int objc, Tcl_Obj *const *objv)
     4797{
     4798    const char *string = Tcl_GetString(objv[3]);
     4799    char c = string[0];
     4800    if ((c != 'd') || (strcmp(string, "data") != 0)) {
     4801        Tcl_AppendResult(interp, "bad streamlines seed fmesh option \"",
     4802                         string, "\": should be data", (char*)NULL);
     4803        return TCL_ERROR;
     4804    }
     4805    string = Tcl_GetString(objv[4]);
     4806    c = string[0];
     4807    if ((c != 'f') || (strcmp(string, "follows") != 0)) {
     4808        Tcl_AppendResult(interp, "bad streamlines seed fmesh option \"",
     4809                         string, "\": should be follows", (char*)NULL);
     4810        return TCL_ERROR;
     4811    }
     4812    int nbytes = 0;
     4813    if (Tcl_GetIntFromObj(interp, objv[5], &nbytes) != TCL_OK ||
     4814        nbytes < 0) {
     4815        return TCL_ERROR;
     4816    }
     4817    char *data = (char *)malloc(nbytes);
     4818    size_t bytesRead = SocketRead(data, nbytes);
     4819    if (bytesRead < (size_t)nbytes) {
     4820        free(data);
     4821        return TCL_ERROR;
     4822    }
     4823    if (objc == 7) {
     4824        const char *name = Tcl_GetString(objv[6]);
     4825        if (!g_renderer->setStreamlinesSeedToMeshPoints(name, data, nbytes)) {
     4826            free(data);
     4827            Tcl_AppendResult(interp, "Couldn't read mesh data or streamlines not found", (char*)NULL);
     4828            return TCL_ERROR;
     4829        }
     4830    } else {
     4831        if (!g_renderer->setStreamlinesSeedToMeshPoints("all", data, nbytes)) {
     4832            free(data);
     4833            Tcl_AppendResult(interp, "Couldn't read mesh data or streamlines not found", (char*)NULL);
     4834            return TCL_ERROR;
     4835        }
     4836    }
     4837    free(data);
     4838    return TCL_OK;
     4839}
     4840
     4841static int
     4842StreamlinesSeedPointsOp(ClientData clientData, Tcl_Interp *interp, int objc,
     4843                        Tcl_Obj *const *objv)
     4844{
     4845    if (objc == 4) {
     4846        const char *name = Tcl_GetString(objv[3]);
     4847        g_renderer->setStreamlinesSeedToMeshPoints(name);
     4848    } else {
     4849        g_renderer->setStreamlinesSeedToMeshPoints("all");
     4850    }
     4851    return TCL_OK;
     4852}
     4853
     4854static int
    43884855StreamlinesSeedPolygonOp(ClientData clientData, Tcl_Interp *interp, int objc,
    43894856                         Tcl_Obj *const *objv)
     
    44984965    if (objc == 5) {
    44994966        const char *name = Tcl_GetString(objv[4]);
    4500         g_renderer->setStreamlinesSeedToRandomPoints(name, numPoints);
    4501     } else {
    4502         g_renderer->setStreamlinesSeedToRandomPoints("all", numPoints);
     4967        g_renderer->setStreamlinesSeedToFilledMesh(name, numPoints);
     4968    } else {
     4969        g_renderer->setStreamlinesSeedToFilledMesh("all", numPoints);
    45034970    }
    45044971    return TCL_OK;
     
    45254992    {"color",   1, StreamlinesSeedColorOp, 6, 7, "r g b ?dataSetName?"},
    45264993    {"disk",    1, StreamlinesSeedDiskOp, 12, 13, "centerX centerY centerZ normalX normalY normalZ radius innerRadius numPoints ?dataSetName?"},
    4527     {"fpoly",   1, StreamlinesSeedFilledPolygonOp, 13, 14, "centerX centerY centerZ normalX normalY normalZ angle radius numSides numPoints ?dataSetName?"},
    4528     {"polygon", 1, StreamlinesSeedPolygonOp, 12, 13, "centerX centerY centerZ normalX normalY normalZ angle radius numSides ?dataSetName?"},
     4994    {"fmesh",   2, StreamlinesSeedFilledMeshOp, 7, 8, "numPoints data follows nbytes ?dataSetName?"},
     4995    {"fpoly",   2, StreamlinesSeedFilledPolygonOp, 13, 14, "centerX centerY centerZ normalX normalY normalZ angle radius numSides numPoints ?dataSetName?"},
     4996    {"mesh",    1, StreamlinesSeedMeshPointsOp, 6, 7, "data follows nbytes ?dataSetName?"},
     4997    {"points",  3, StreamlinesSeedPointsOp, 3, 4, "?dataSetName?"},
     4998    {"polygon", 3, StreamlinesSeedPolygonOp, 12, 13, "centerX centerY centerZ normalX normalY normalZ angle radius numSides ?dataSetName?"},
    45294999    {"rake",    3, StreamlinesSeedRakeOp, 10, 11, "startX startY startZ endX endY endZ numPoints ?dataSetName?"},
    45305000    {"random",  3, StreamlinesSeedRandomOp, 4, 5, "numPoints ?dataSetName?"},
     
    46025072    {"ribbons",   1, StreamlinesRibbonsOp,   4, 5, "width angle ?dataSetName?"},
    46035073    {"scale",     2, StreamlinesScaleOp,     5, 6, "sx sy sz ?dataSetName?"},
    4604     {"seed",      2, StreamlinesSeedOp,  4, 14, "op params... ?dataSetName?"},
     5074    {"seed",      2, StreamlinesSeedOp,  3, 14, "op params... ?dataSetName?"},
    46055075    {"tubes",     1, StreamlinesTubesOp, 4, 5, "numSides radius ?dataSetName?"},
    46065076    {"visible",   1, StreamlinesVisibleOp, 3, 4, "bool ?dataSetName?"}
     
    49805450    Tcl_CreateObjCommand(interp, "contour2d",   Contour2DCmd,   clientData, NULL);
    49815451    Tcl_CreateObjCommand(interp, "contour3d",   Contour3DCmd,   clientData, NULL);
     5452    Tcl_CreateObjCommand(interp, "cutplane",    CutplaneCmd,    clientData, NULL);
    49825453    Tcl_CreateObjCommand(interp, "dataset",     DataSetCmd,     clientData, NULL);
    49835454    Tcl_CreateObjCommand(interp, "glyphs",      GlyphsCmd,      clientData, NULL);
     
    50065477    Tcl_DeleteCommand(interp, "contour2d");
    50075478    Tcl_DeleteCommand(interp, "contour3d");
     5479    Tcl_DeleteCommand(interp, "cutplane");
    50085480    Tcl_DeleteCommand(interp, "dataset");
    50095481    Tcl_DeleteCommand(interp, "glyphs");
  • branches/vtkvis_threaded/Trace.cpp

    r2495 r2523  
    33 * Copyright (C) 2011, Purdue Research Foundation
    44 *
    5  * Author: ?
     5 * Author: George A. Howlett <gah@purdue.edu>
    66 */
    77
  • branches/vtkvis_threaded/Trace.h

    r2495 r2523  
    33 * Copyright (C) 2011, Purdue Research Foundation
    44 *
    5  * Author: ?
     5 * Author: George A. Howlett <gah@purdue.edu>
    66 */
    77
  • branches/vtkvis_threaded/protocol.txt

    r2496 r2523  
    144144contour3d wireframe <bool> <?datasetName?>
    145145
    146 glyphs add <?dataSetName?>
     146cutplane add <?dataSetName?>
     147cutplane colormap <colorMapName> <?dataSetName?>
     148cutplane colormode <scalar|vmag|vx|vy|vz> <?datasetName?>
     149         Set the field used to color the object.  'scalar' uses
     150         the active scalar field.  'vmag' uses the magnitude of the current
     151         vector field, and 'vx','vy','vz' use the corresponding component of
     152         the active vector field.
     153cutplane delete <?dataSetName?>
     154cutplane edges <bool> <?dataSetName?>
     155cutplane lighting <bool> <?dataSetName?>
     156cutplane linecolor <r> <g> <b> <?dataSetName?>
     157cutplane linewidth <width> <?dataSetName?>
     158cutplane opacity <value> <?dataSetName?>
     159cutplane orient <qw> <qx> <qy> <qz> <?dataSetName?>
     160cutplane pos <x> <y> <z> <?dataSetName?>
     161cutplane scale <sx> <sy> <sz> <?dataSetName?>
     162cutplane slice axis ratio <?dataSetName?>
     163         For 3D data, select a slice along a principle axis of the volume. The
     164         ratio is [0,1]
     165cutplane visible <bool> <?dataSetName?>
     166cutplane wireframe <bool> <?datasetName?>
     167
     168glyphs add <shape> <?dataSetName?>
     169       See 'glyphs shape' for list of shapes
    147170glyphs ccolor r g b <?datasetName?>
    148171glyphs colormap <colorMapName> <?dataSetName?>
     
    193216heightmap pos <x> <y> <z> <?dataSetName?>
    194217heightmap scale <sx> <sy> <sz> <?dataSetName?>
     218heightmap slice axis ratio <?dataSetName?>
     219          For 3D data, select a slice along a principle axis of the volume. The
     220          ratio is [0,1]
    195221heightmap surface <bool> <?dataSetName?>
    196222          Toggle rendering of colormapped surface (mountain plot or cutplane)
    197223heightmap visible <bool> <?dataSetName?>
    198 heightmap volumeslice axis ratio <?dataSetName?>
    199           For 3D data, select a slice along a principle axis of the volume. The
    200           ratio is [0,1]
    201224heightmap wireframe <bool> <?datasetName?>
    202225
     
    212235lic pos <x> <y> <z> <?dataSetName?>
    213236lic scale <sx> <sy> <sz> <?dataSetName?>
     237lic slice <axis> <ratio> <?datasetName?>
     238    For 3D data, select a slice along a principle axis of the volume. The
     239    ratio is [0,1]
    214240lic visible <bool> <?datasetName?>
    215 lic volumeslice <axis> <ratio> <?datasetName?>
    216241
    217242molecule add <?datasetName?>
     
    305330            Create a disk seed area with optional hole, filled with randomly
    306331            placed points
     332streamlines seed fmesh <numPoints> data follows <nbytes> <?datasetName?>
     333            Fill a mesh supplied as a VTK data file with randomly placed points
    307334streamlines seed fpoly <centerX> <centerY> <centerZ> <normalX> <normalY> <normalZ> <angle> <radius> <numSides> <numPoints> <?dataSetName?>
    308335            Create a regular n-sided polygonal seed area filled with randomly
    309336            placed points
     337streamlines seed mesh data follows <nbytes> <?datasetName?>
     338            Use points of a mesh supplied as a VTK data file
     339streamlines seed points <?datasetName?>
     340            Use points of the streamlines' dataset mesh
    310341streamlines seed polygon <centerX> <centerY> <centerZ> <normalX> <normalY> <normalZ> <angle> <radius> <numSides> <?dataSetName?>
    311342            Create seed points from vertices of a regular n-sided polygon
    312343streamlines seed rake <startX> <startY> <startZ> <endX> <endY> <endZ> <numPoints> <?datasetName?>
    313344streamlines seed random <numPoints> <?datasetName?>
     345            Fill the streamlines' dataset mesh with randomly placed points
    314346streamlines seed visible <bool> <?datasetName?>
    315347streamlines tubes <numSides> <radius> <?datasetName?>
  • branches/vtkvis_threaded/vtkRpCubeAxesActor2D.cpp

    r2496 r2523  
    439439  // can be changed). Therefore, we can not just assign pointers otherwise
    440440  // each individual axis text prop would point to the same text prop.
    441 #ifdef notdef
     441#if 1
    442442  if (this->AxisLabelTextProperty &&
    443443      this->AxisLabelTextProperty->GetMTime() > this->BuildTime)
     
    10781078}
    10791079
    1080 //----------------------------------------------------------------------------
    1081 
    1082 // Disable warnings about qualifiers on return types.
    1083 #if defined(_COMPILER_VERSION)
    1084 # pragma set woff 3303
    1085 #endif
    1086 #if defined(__INTEL_COMPILER)
    1087 # pragma warning (disable:858)
    1088 #endif
    1089 
    1090 #ifndef VTK_LEGACY_REMOVE
    1091 # ifdef VTK_WORKAROUND_WINDOWS_MANGLE
    1092 #  undef SetProp
    1093 #  undef GetProp
    1094 void vtkRpCubeAxesActor2D::SetPropA(vtkProp* prop)
    1095 {
    1096   VTK_LEGACY_REPLACED_BODY(vtkRpCubeAxesActor2D::SetProp, "VTK 5.0",
    1097                            vtkRpCubeAxesActor2D::SetViewProp);
    1098   this->SetViewProp(prop);
    1099 }
    1100 void vtkRpCubeAxesActor2D::SetPropW(vtkProp* prop)
    1101 {
    1102   VTK_LEGACY_REPLACED_BODY(vtkRpCubeAxesActor2D::SetProp, "VTK 5.0",
    1103                            vtkRpCubeAxesActor2D::SetViewProp);
    1104   this->SetViewProp(prop);
    1105 }
    1106 vtkProp* vtkRpCubeAxesActor2D::GetPropA()
    1107 {
    1108   VTK_LEGACY_REPLACED_BODY(vtkRpCubeAxesActor2D::GetProp, "VTK 5.0",
    1109                            vtkRpCubeAxesActor2D::GetViewProp);
    1110   return this->GetViewProp();
    1111 }
    1112 vtkProp* vtkRpCubeAxesActor2D::GetPropW()
    1113 {
    1114   VTK_LEGACY_REPLACED_BODY(vtkRpCubeAxesActor2D::GetProp, "VTK 5.0",
    1115                            vtkRpCubeAxesActor2D::GetViewProp);
    1116   return this->GetViewProp();
    1117 }
    1118 # endif
    1119 void vtkRpCubeAxesActor2D::SetProp(vtkProp* prop)
    1120 {
    1121   VTK_LEGACY_REPLACED_BODY(vtkRpCubeAxesActor2D::SetProp, "VTK 5.0",
    1122                            vtkRpCubeAxesActor2D::SetViewProp);
    1123   this->SetViewProp(prop);
    1124 }
    1125 vtkProp* vtkRpCubeAxesActor2D::GetProp()
    1126 {
    1127   VTK_LEGACY_REPLACED_BODY(vtkRpCubeAxesActor2D::GetProp, "VTK 5.0",
    1128                            vtkRpCubeAxesActor2D::GetViewProp);
    1129   return this->GetViewProp();
    1130 }
    1131 #endif
  • branches/vtkvis_threaded/vtkRpCubeAxesActor2D.h

    r2320 r2523  
    253253  void ShallowCopy(vtkRpCubeAxesActor2D *actor);
    254254
    255 // Disable warnings about qualifiers on return types.
    256 #if defined(_COMPILER_VERSION)
    257 # pragma set woff 3303
    258 #endif
    259 #if defined(__INTEL_COMPILER)
    260 # pragma warning (push)
    261 # pragma warning (disable:858)
    262 #endif
    263 
    264 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
    265 # define SetPropA SetProp
    266 # define SetPropW SetProp
    267 # define GetPropA GetProp
    268 # define GetPropW GetProp
    269 #endif
    270 
    271   // Description:
    272   // @deprecated Replaced by vtkRpCubeAxesActor2D::SetViewProp() as of VTK 5.0.
    273   VTK_LEGACY(virtual void SetProp(vtkProp* prop));
    274 
    275   // Description:
    276   // @deprecated Replaced by vtkRpCubeAxesActor2D::GetViewProp() as of VTK 5.0.
    277   VTK_LEGACY(virtual vtkProp* GetProp());
    278 
    279 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
    280 # undef SetPropW
    281 # undef SetPropA
    282 # undef GetPropW
    283 # undef GetPropA
    284   //BTX
    285   VTK_LEGACY(virtual void SetPropA(vtkProp* prop));
    286   VTK_LEGACY(virtual void SetPropW(vtkProp* prop));
    287   VTK_LEGACY(virtual vtkProp* GetPropA());
    288   VTK_LEGACY(virtual vtkProp* GetPropW());
    289   //ETX
    290 #endif
    291 
    292 // Reset disabled warning about qualifiers on return types.
    293 #if defined(__INTEL_COMPILER)
    294 # pragma warning (pop)
    295 #endif
    296 #if defined(_COMPILER_VERSION)
    297 # pragma reset woff 3303
    298 #endif
    299 
    300255protected:
    301256  vtkRpCubeAxesActor2D();
Note: See TracChangeset for help on using the changeset viewer.