Ignore:
Timestamp:
Jul 16, 2012 11:37:07 AM (12 years ago)
Author:
ldelgass
Message:

Add ability to specify field used for orienting glyphs

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

Legend:

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

    r3092 r3095  
    298298
    299299#ifdef HAVE_GLYPH3D_MAPPER
     300/**
     301 * \brief Turn on/off orienting glyphs from a vector field
     302 */
     303void Glyphs::setOrientMode(bool mode, const char *name)
     304{
     305    if (_glyphMapper != NULL) {
     306        _glyphMapper->SetOrient(mode ? 1 : 0);
     307        if (name != NULL && strlen(name) > 0) {
     308            _glyphMapper->SetOrientationArray(name);
     309        } else {
     310            _glyphMapper->SetOrientationArray(vtkDataSetAttributes::VECTORS);
     311        }
     312    }
     313}
     314
    300315/**
    301316 * \brief Control how glyphs are scaled
  • trunk/packages/vizservers/vtkvis/RpGlyphs.h

    r3092 r3095  
    8080
    8181#ifdef HAVE_GLYPH3D_MAPPER
     82    void setOrientMode(bool mode, const char *name);
     83
    8284    void setScalingMode(ScalingMode mode, const char *name, double range[2]);
    8385
  • trunk/packages/vizservers/vtkvis/RpVtkRenderer.h

    r3092 r3095  
    394394    void setGlyphsShape(const DataSetId& id, Glyphs::GlyphShape shape);
    395395
    396     void setGlyphsOrient(const DataSetId& id, bool state);
     396    void setGlyphsOrientMode(const DataSetId& id, bool state, const char *name);
    397397
    398398    void setGlyphsColorMode(const DataSetId& id,
  • trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp

    r3092 r3095  
    23682368        return TCL_ERROR;
    23692369    }
    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);
     2370    const char *fieldName = Tcl_GetString(objv[3]);
     2371    if (objc == 5) {
     2372        const char *name = Tcl_GetString(objv[4]);
     2373        g_renderer->setGlyphsOrientMode(name, state, fieldName);
     2374    } else {
     2375        g_renderer->setGlyphsOrientMode("all", state, fieldName);
    23752376    }
    23762377    return TCL_OK;
     
    25442545    {"delete",    1, GlyphsDeleteOp, 2, 3, "?dataSetName?"},
    25452546    {"edges",     1, GlyphsEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"},
    2546     {"gorient",   2, GlyphsOrientGlyphsOp, 3, 4, "bool ?dataSetName?"},
     2547    {"gorient",   2, GlyphsOrientGlyphsOp, 4, 5, "bool fieldName ?dataSetName?"},
    25472548    {"gscale",    2, GlyphsScaleFactorOp, 3, 4, "scaleFactor ?dataSetName?"},
    25482549    {"lighting",  3, GlyphsLightingOp, 3, 4, "bool ?dataSetName?"},
  • trunk/packages/vizservers/vtkvis/RpVtkRendererGraphicsObjs.cpp

    r3092 r3095  
    701701 * given DataSet
    702702 */
    703 void Renderer::setGlyphsOrient(const DataSetId& id, bool state)
     703void Renderer::setGlyphsOrientMode(const DataSetId& id, bool state,
     704                                   const char *name)
    704705{
    705706    GlyphsHashmap::iterator itr;
     
    719720
    720721    do {
     722#ifdef HAVE_GLYPH3D_MAPPER
     723        itr->second->setOrientMode(state, name);
     724#else
     725        if (name != NULL && strlen(name) > 0) {
     726            WARN("Glyphs orient mode doesn't support named fields for VTK < 5.8.0");
     727        }
    721728        itr->second->setOrient(state);
     729#endif
    722730    } while (doAll && ++itr != _glyphs.end());
    723731
     
    904912     } while (doAll && ++itr != _heightMaps.end());
    905913
    906     initCamera();
     914    _renderer->ResetCameraClippingRange();
     915    resetAxes();
    907916    _needsRedraw = true;
    908917}
Note: See TracChangeset for help on using the changeset viewer.