Changeset 2329 for trunk/packages


Ignore:
Timestamp:
Aug 3, 2011, 6:10:59 AM (13 years ago)
Author:
ldelgass
Message:

Add option to position ticks inside, outside or both locations to 3D axes

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

Legend:

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

    r2328 r2329  
    898898    setAxisTickVisibility(Y_AXIS, state);
    899899    setAxisTickVisibility(Z_AXIS, state);
     900}
     901
     902/**
     903 * \brief Control position of ticks on 3D axes
     904 */
     905void Renderer::setAxesTickPosition(AxesTickPosition pos)
     906{
     907    if (_cubeAxesActor == NULL)
     908        return;
     909
     910    switch (pos) {
     911    case TICKS_BOTH:
     912        _cubeAxesActor->SetTickLocationToBoth();
     913        break;
     914    case TICKS_OUTSIDE:
     915        _cubeAxesActor->SetTickLocationToOutside();
     916        break;
     917    case TICKS_INSIDE:
     918    default:
     919        _cubeAxesActor->SetTickLocationToInside();
     920        break;
     921    }
     922    _needsRedraw = true;
    900923}
    901924
  • trunk/packages/vizservers/vtkvis/RpVtkRenderer.h

    r2328 r2329  
    6767        FLY_STATIC_EDGES,
    6868        FLY_STATIC_TRIAD
     69    };
     70
     71    enum AxesTickPosition {
     72        TICKS_INSIDE,
     73        TICKS_OUTSIDE,
     74        TICKS_BOTH
    6975    };
    7076
     
    185191
    186192    void setAxesTickVisibility(bool state);
     193
     194    void setAxesTickPosition(AxesTickPosition pos);
    187195
    188196    void setAxesColor(double color[3]);
  • trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp

    r2328 r2329  
    199199
    200200static int
     201AxisTickPositionOp(ClientData clientData, Tcl_Interp *interp, int objc,
     202                   Tcl_Obj *const *objv)
     203{
     204    const char *string = Tcl_GetString(objv[2]);
     205    char c = string[0];
     206    if ((c == 'i') && (strcmp(string, "inside") == 0)) {
     207        g_renderer->setAxesTickPosition(Renderer::TICKS_INSIDE);
     208    } else if ((c == 'o') && (strcmp(string, "outside") == 0)) {
     209        g_renderer->setAxesTickPosition(Renderer::TICKS_OUTSIDE);
     210    } else if ((c == 'b') && (strcmp(string, "both") == 0)) {
     211        g_renderer->setAxesTickPosition(Renderer::TICKS_BOTH);
     212    } else {
     213        Tcl_AppendResult(interp, "bad axis option \"", string,
     214                         "\": should be inside, outside or both", (char*)NULL);
     215        return TCL_ERROR;
     216    }
     217    return TCL_OK;
     218}
     219
     220static int
    201221AxisUnitsOp(ClientData clientData, Tcl_Interp *interp, int objc,
    202222            Tcl_Obj *const *objv)
     
    251271    {"labels",  1, AxisLabelsVisibleOp, 4, 4, "axis bool"},
    252272    {"name",    1, AxisNameOp, 4, 4, "axis title"},
    253     {"ticks",   1, AxisTicksVisibleOp, 4, 4, "axis bool"},
     273    {"tickpos", 2, AxisTickPositionOp, 3, 3, "position"},
     274    {"ticks",   2, AxisTicksVisibleOp, 4, 4, "axis bool"},
    254275    {"units",   1, AxisUnitsOp, 4, 4, "axis units"},
    255276    {"visible", 1, AxisVisibleOp, 4, 4, "axis bool"}
  • trunk/packages/vizservers/vtkvis/protocol.txt

    r2328 r2329  
    1515renderer depthpeel <bool>
    1616         Set use of depth peeling algorithm for transparency
     17renderer render
     18         Force a new image to be rendered - use for advancing animation
    1719
    1820axis color <r> <g> <b>
     
    2527     <axis> = x|y|z|all
    2628axis name <axis> <title>
     29axis tickpos <position>
     30     Set position of ticks on 3D axes (not implemented for 2D axes)
     31     <position> = inside|outside|both
    2732axis ticks <axis> <bool>
    2833     Toggle visibility of axis tick marks
Note: See TracChangeset for help on using the changeset viewer.