Changeset 3677


Ignore:
Timestamp:
Jun 5, 2013 12:02:23 AM (11 years ago)
Author:
ldelgass
Message:

Add simple point source to glyphs as alternative way of rendering point clouds.

Location:
trunk/packages/vizservers/vtkvis
Files:
4 edited

Legend:

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

    r3621 r3677  
    2222#include <vtkCylinderSource.h>
    2323#include <vtkPlatonicSolidSource.h>
     24#include <vtkPointSource.h>
    2425#include <vtkSphereSource.h>
    2526#include <vtkTransform.h>
     
    145146        _glyphSource = vtkSmartPointer<vtkPlatonicSolidSource>::New();
    146147        vtkPlatonicSolidSource::SafeDownCast(_glyphSource)->SetSolidTypeToOctahedron();
     148        break;
     149    case POINT:
     150        _glyphSource = vtkSmartPointer<vtkPointSource>::New();
     151        vtkPointSource::SafeDownCast(_glyphSource)->SetNumberOfPoints(1);
     152        vtkPointSource::SafeDownCast(_glyphSource)->SetCenter(0, 0, 0);
     153        vtkPointSource::SafeDownCast(_glyphSource)->SetRadius(0);
     154        vtkPointSource::SafeDownCast(_glyphSource)->SetDistributionToUniform();
    147155        break;
    148156    case SPHERE: {
  • trunk/packages/vizservers/vtkvis/Glyphs.h

    r3621 r3677  
    4040        LINE,
    4141        OCTAHEDRON,
     42        POINT,
    4243        SPHERE,
    4344        TETRAHEDRON
  • trunk/packages/vizservers/vtkvis/RendererCmd.cpp

    r3641 r3677  
    49194919    } else if (shapeOpt[0] == 'o' && strcmp(shapeOpt, "octahedron") == 0) {
    49204920        shape = Glyphs::OCTAHEDRON;
     4921    } else if (shapeOpt[0] == 'p' && strcmp(shapeOpt, "point") == 0) {
     4922        shape = Glyphs::POINT;
    49214923    } else if (shapeOpt[0] == 's' && strcmp(shapeOpt, "sphere") == 0) {
    49224924        shape = Glyphs::SPHERE;
     
    49254927    } else {
    49264928        Tcl_AppendResult(interp, "bad shape option \"", shapeOpt,
    4927                          "\": should be one of: 'arrow', 'cone', 'cube', 'cylinder', 'dodecahedron', 'icosahedron', 'octahedron', 'sphere', 'tetrahedron'", (char*)NULL);
     4929                         "\": should be one of: 'arrow', 'cone', 'cube', 'cylinder', 'dodecahedron', 'icosahedron', 'octahedron', 'point', 'sphere', 'tetrahedron'", (char*)NULL);
    49284930        return TCL_ERROR;
    49294931    }
     
    51645166    } else {
    51655167        g_renderer->setGlyphsOrientMode("all", state, fieldName);
     5168    }
     5169    return TCL_OK;
     5170}
     5171
     5172static int
     5173GlyphsPointSizeOp(ClientData clientData, Tcl_Interp *interp, int objc,
     5174                  Tcl_Obj *const *objv)
     5175{
     5176    float size;
     5177    if (GetFloatFromObj(interp, objv[2], &size) != TCL_OK) {
     5178        return TCL_ERROR;
     5179    }
     5180    if (objc == 4) {
     5181        const char *name = Tcl_GetString(objv[3]);
     5182        g_renderer->setGraphicsObjectPointSize<Glyphs>(name, size);
     5183    } else {
     5184        g_renderer->setGraphicsObjectPointSize<Glyphs>("all", size);
    51665185    }
    51675186    return TCL_OK;
     
    52755294    } else if (shapeOpt[0] == 'o' && strcmp(shapeOpt, "octahedron") == 0) {
    52765295        shape = Glyphs::OCTAHEDRON;
     5296    } else if (shapeOpt[0] == 'p' && strcmp(shapeOpt, "point") == 0) {
     5297        shape = Glyphs::POINT;
    52775298    } else if (shapeOpt[0] == 's' && strcmp(shapeOpt, "sphere") == 0) {
    52785299        shape = Glyphs::SPHERE;
     
    52815302    } else {
    52825303        Tcl_AppendResult(interp, "bad shape option \"", shapeOpt,
    5283                          "\": should be one of: 'arrow', 'cone', 'cube', 'cylinder', 'dodecahedron', 'icosahedron', 'line', 'octahedron', 'sphere', 'tetrahedron'", (char*)NULL);
     5304                         "\": should be one of: 'arrow', 'cone', 'cube', 'cylinder', 'dodecahedron', 'icosahedron', 'line', 'octahedron', 'point', 'sphere', 'tetrahedron'", (char*)NULL);
    52845305        return TCL_ERROR;
    52855306    }
     
    53435364    {"opacity",      2, GlyphsOpacityOp, 3, 4, "value ?dataSetName?"},
    53445365    {"orient",       2, GlyphsOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"},
    5345     {"pos",          1, GlyphsPositionOp, 5, 6, "x y z ?dataSetName?"},
     5366    {"pos",          2, GlyphsPositionOp, 5, 6, "x y z ?dataSetName?"},
     5367    {"ptsize",       2, GlyphsPointSizeOp, 3, 4, "size ?dataSetName?"},
    53465368    {"scale",        2, GlyphsScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
    53475369    {"shape",        2, GlyphsShapeOp, 3, 4, "shapeVal ?dataSetName?"},
     
    66106632    return TCL_OK;
    66116633}
    6612 
    66136634
    66146635static int
  • trunk/packages/vizservers/vtkvis/protocol.txt

    r3641 r3677  
    461461glyphs orient <qw> <qx> <qy> <qz> <?dataSetName?>
    462462glyphs pos <x> <y> <z> <?dataSetName?>
     463glyphs ptsize <size> <?dataSetName?>
    463464glyphs scale <sx> <sy> <sz> <?dataSetName?>
    464 glyphs shape <arrow|cone|cube|cylinder|dodecahedron|icosahedron|line|octahedron|sphere|tetrahedron> <?datasetName?>
     465glyphs shape <arrow|cone|cube|cylinder|dodecahedron|icosahedron|line|octahedron|point|sphere|tetrahedron> <?datasetName?>
    465466glyphs smode <scalar|vmag|vcomp|off> <fieldName> <?dataSetName?>
    466467       Set the scaling mode: use the scalar field, vector magnitude
Note: See TracChangeset for help on using the changeset viewer.