Ignore:
Timestamp:
Jul 14, 2012 1:47:06 PM (12 years ago)
Author:
ldelgass
Message:

Add 'glyphs gorient' command to toggle orienting glyphs by a vector field.

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

Legend:

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

    r2641 r3092  
    638638
    639639/**
     640 * \brief Turn on/off orienting glyphs from a vector field
     641 */
     642void Glyphs::setOrient(bool state)
     643{
     644#ifdef HAVE_GLYPH3D_MAPPER
     645    if (_glyphMapper != NULL) {
     646        _glyphMapper->SetOrient(state ? 1 : 0);
     647    }
     648#else
     649    if (_glyphGenerator != NULL) {
     650        _glyphGenerator->SetOrient(state ? 1 : 0);
     651    }
     652#endif
     653}
     654
     655/**
    640656 * \brief Controls relative scaling of glyphs
    641657 */
  • trunk/packages/vizservers/vtkvis/RpGlyphs.h

    r2641 r3092  
    7777    virtual void setClippingPlanes(vtkPlaneCollection *planes);
    7878
     79    void setOrient(bool state);
     80
    7981#ifdef HAVE_GLYPH3D_MAPPER
    8082    void setScalingMode(ScalingMode mode, const char *name, double range[2]);
  • trunk/packages/vizservers/vtkvis/RpVtkGraphicsObject.h

    r2771 r3092  
    658658        if (getActor() != NULL) {
    659659            setCulling(getActor()->GetProperty(), state);
    660          } else if (getAssembly() != NULL) {
     660        } else if (getAssembly() != NULL) {
    661661            vtkProp3DCollection *props = getAssembly()->GetParts();
    662662            vtkProp3D *prop;
  • trunk/packages/vizservers/vtkvis/RpVtkRenderer.h

    r2866 r3092  
    393393
    394394    void setGlyphsShape(const DataSetId& id, Glyphs::GlyphShape shape);
     395
     396    void setGlyphsOrient(const DataSetId& id, bool state);
    395397
    396398    void setGlyphsColorMode(const DataSetId& id,
  • trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp

    r2757 r3092  
    23612361
    23622362static int
     2363GlyphsOrientGlyphsOp(ClientData clientData, Tcl_Interp *interp, int objc,
     2364                     Tcl_Obj *const *objv)
     2365{
     2366    bool state;
     2367    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     2368        return TCL_ERROR;
     2369    }
     2370    if (objc == 4) {
     2371        const char *name = Tcl_GetString(objv[3]);
     2372        g_renderer->setGlyphsOrient(name, state);
     2373    } else {
     2374        g_renderer->setGlyphsOrient("all", state);
     2375    }
     2376    return TCL_OK;
     2377}
     2378
     2379static int
    23632380GlyphsPositionOp(ClientData clientData, Tcl_Interp *interp, int objc,
    23642381                 Tcl_Obj *const *objv)
     
    25272544    {"delete",    1, GlyphsDeleteOp, 2, 3, "?dataSetName?"},
    25282545    {"edges",     1, GlyphsEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"},
    2529     {"gscale",    1, GlyphsScaleFactorOp, 3, 4, "scaleFactor ?dataSetName?"},
     2546    {"gorient",   2, GlyphsOrientGlyphsOp, 3, 4, "bool ?dataSetName?"},
     2547    {"gscale",    2, GlyphsScaleFactorOp, 3, 4, "scaleFactor ?dataSetName?"},
    25302548    {"lighting",  3, GlyphsLightingOp, 3, 4, "bool ?dataSetName?"},
    25312549    {"linecolor", 5, GlyphsLineColorOp, 5, 6, "r g b ?dataSetName?"},
  • trunk/packages/vizservers/vtkvis/RpVtkRendererGraphicsObjs.cpp

    r2757 r3092  
    698698
    699699/**
     700 * \brief Controls if glyphs are oriented from a vector field for the
     701 * given DataSet
     702 */
     703void Renderer::setGlyphsOrient(const DataSetId& id, bool state)
     704{
     705    GlyphsHashmap::iterator itr;
     706
     707    bool doAll = false;
     708
     709    if (id.compare("all") == 0) {
     710        itr = _glyphs.begin();
     711        doAll = true;
     712    } else {
     713        itr = _glyphs.find(id);
     714    }
     715    if (itr == _glyphs.end()) {
     716        ERROR("Glyphs not found: %s", id.c_str());
     717        return;
     718    }
     719
     720    do {
     721        itr->second->setOrient(state);
     722    } while (doAll && ++itr != _glyphs.end());
     723
     724    _renderer->ResetCameraClippingRange();
     725    _needsRedraw = true;
     726}
     727
     728/**
    700729 * \brief Set the shape of Glyphs for the given DataSet
    701730 */
  • trunk/packages/vizservers/vtkvis/protocol.txt

    r3085 r3092  
    204204glyphs delete <?dataSetName?>
    205205glyphs edges <bool> <?datasetName?>
     206glyphs gorient <bool> <?datasetName?>
    206207glyphs gscale <scaleFactor> <?datasetName?>
    207208       Set glyph scaling factor
Note: See TracChangeset for help on using the changeset viewer.