Changeset 4082


Ignore:
Timestamp:
Dec 17, 2013 12:16:54 PM (8 years ago)
Author:
ldelgass
Message:

Add 3D texture based orthogonal cutplanes (requires uniform grid dataset)

Location:
trunk/packages/vizservers/vtkvis
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/vtkvis/GraphicsObject.h

    r4037 r4082  
    287287        PrincipalPlane plane;
    288288        if (!_dataSet->is2D(&plane)) {
    289             TRACE("Not setting aspect for 3D object");
     289            TRACE("Not setting aspect for 3D object %s", getClassName());
    290290            return;
    291291        }
  • trunk/packages/vizservers/vtkvis/Makefile.in

    r4074 r4082  
    158158                HeightMap.cpp \
    159159                Image.cpp \
     160                ImageCutplane.cpp \
    160161                LIC.cpp \
    161162                Line.cpp \
  • trunk/packages/vizservers/vtkvis/Renderer.cpp

    r4079 r4082  
    194194    deleteAllGraphicsObjects<HeightMap>();
    195195    deleteAllGraphicsObjects<Image>();
     196    deleteAllGraphicsObjects<ImageCutplane>();
    196197    deleteAllGraphicsObjects<LIC>();
    197198    deleteAllGraphicsObjects<Line>();
     
    277278        deleteGraphicsObject<HeightMap>(itr->second->getName());
    278279        deleteGraphicsObject<Image>(itr->second->getName());
     280        deleteGraphicsObject<ImageCutplane>(itr->second->getName());
    279281        deleteGraphicsObject<LIC>(itr->second->getName());
    280282        deleteGraphicsObject<Molecule>(itr->second->getName());
     
    15821584    updateGraphicsObjectColorMap<HeightMap>(cmap);
    15831585    updateGraphicsObjectColorMap<Image>(cmap);
     1586    updateGraphicsObjectColorMap<ImageCutplane>(cmap);
    15841587    updateGraphicsObjectColorMap<LIC>(cmap);
    15851588    updateGraphicsObjectColorMap<Molecule>(cmap);
     
    16081611        return true;
    16091612    if (graphicsObjectColorMapUsed<Image>(cmap))
     1613        return true;
     1614    if (graphicsObjectColorMapUsed<ImageCutplane>(cmap))
    16101615        return true;
    16111616    if (graphicsObjectColorMapUsed<LIC>(cmap))
     
    24652470    setGraphicsObjectAspect<HeightMap>(aspectRatio);
    24662471    setGraphicsObjectAspect<Image>(aspectRatio);
     2472    setGraphicsObjectAspect<ImageCutplane>(aspectRatio);
    24672473    setGraphicsObjectAspect<LIC>(aspectRatio);
    24682474    setGraphicsObjectAspect<Line>(aspectRatio);
     
    33873393    mergeGraphicsObjectBounds<HeightMap>(bounds, onlyVisible);
    33883394    mergeGraphicsObjectBounds<Image>(bounds, onlyVisible);
     3395    mergeGraphicsObjectBounds<ImageCutplane>(bounds, onlyVisible);
    33893396    mergeGraphicsObjectBounds<LIC>(bounds, onlyVisible);
    33903397    mergeGraphicsObjectBounds<Line>(bounds, onlyVisible);
     
    34593466    mergeGraphicsObjectUnscaledBounds<HeightMap>(bounds, onlyVisible);
    34603467    mergeGraphicsObjectUnscaledBounds<Image>(bounds, onlyVisible);
     3468    mergeGraphicsObjectUnscaledBounds<ImageCutplane>(bounds, onlyVisible);
    34613469    mergeGraphicsObjectUnscaledBounds<LIC>(bounds, onlyVisible);
    34623470    mergeGraphicsObjectUnscaledBounds<Line>(bounds, onlyVisible);
     
    35173525    updateGraphicsObjectFieldRanges<HeightMap>();
    35183526    updateGraphicsObjectFieldRanges<Image>();
     3527    updateGraphicsObjectFieldRanges<ImageCutplane>();
    35193528    updateGraphicsObjectFieldRanges<LIC>();
    35203529    updateGraphicsObjectFieldRanges<Molecule>();
     
    44014410    if (id.compare("all") == 0 || getGraphicsObject<Image>(id) != NULL)
    44024411        setGraphicsObjectOpacity<Image>(id, opacity);
     4412    if (id.compare("all") == 0 || getGraphicsObject<ImageCutplane>(id) != NULL)
     4413        setGraphicsObjectOpacity<ImageCutplane>(id, opacity);
    44034414    if (id.compare("all") == 0 || getGraphicsObject<LIC>(id) != NULL)
    44044415        setGraphicsObjectOpacity<LIC>(id, opacity);
     
    44594470    if (id.compare("all") == 0 || getGraphicsObject<Image>(id) != NULL)
    44604471        setGraphicsObjectVisibility<Image>(id, state);
     4472    if (id.compare("all") == 0 || getGraphicsObject<ImageCutplane>(id) != NULL)
     4473        setGraphicsObjectVisibility<ImageCutplane>(id, state);
    44614474    if (id.compare("all") == 0 || getGraphicsObject<LIC>(id) != NULL)
    44624475        setGraphicsObjectVisibility<LIC>(id, state);
     
    46094622    setGraphicsObjectClippingPlanes<HeightMap>(_activeClipPlanes);
    46104623    setGraphicsObjectClippingPlanes<Image>(_activeClipPlanes);
     4624    setGraphicsObjectClippingPlanes<ImageCutplane>(_activeClipPlanes);
    46114625    setGraphicsObjectClippingPlanes<LIC>(_activeClipPlanes);
    46124626    setGraphicsObjectClippingPlanes<Line>(_activeClipPlanes);
  • trunk/packages/vizservers/vtkvis/Renderer.h

    r3993 r4082  
    4343#include "HeightMap.h"
    4444#include "Image.h"
     45#include "ImageCutplane.h"
    4546#include "LIC.h"
    4647#include "Line.h"
     
    512513    void setGraphicsObjectVolumeSlice(const DataSetId& id, Axis axis, double ratio);
    513514
    514     //   Prop/Prop3D properties
     515    // Prop/Prop3D properties
    515516
    516517    template<class T>
     
    538539    void setGraphicsObjectVisibility(const DataSetId& id, bool state);
    539540
    540     //   Actor properties
     541    // Actor properties
    541542
    542543    template<class T>
     
    772773
    773774    void setImageZSlice(const DataSetId& id, int z);
     775
     776    // ImageCutplanes
     777
     778    void setImageCutplaneOutlineVisibility(const DataSetId& id, bool state);
     779
     780    void setImageCutplaneSliceVisibility(const DataSetId& id, Axis axis, bool state);
    774781
    775782    // Lines
     
    983990    typedef std::tr1::unordered_map<DataSetId, HeightMap *> HeightMapHashmap;
    984991    typedef std::tr1::unordered_map<DataSetId, Image *> ImageHashmap;
     992    typedef std::tr1::unordered_map<DataSetId, ImageCutplane *> ImageCutplaneHashmap;
    985993    typedef std::tr1::unordered_map<DataSetId, LIC *> LICHashmap;
    986994    typedef std::tr1::unordered_map<DataSetId, Line *> LineHashmap;
     
    11251133    HeightMapHashmap _heightMaps;
    11261134    ImageHashmap _images;
     1135    ImageCutplaneHashmap _imageCutplanes;
    11271136    LICHashmap _lics;
    11281137    LineHashmap _lines;
  • trunk/packages/vizservers/vtkvis/RendererCmd.cpp

    r4080 r4082  
    20772077    Renderer::Aspect aspect;
    20782078    const char *string = Tcl_GetString(objv[2]);
    2079     if ((strcmp(string, "native") == 0)) {
     2079    if (string[0] == 'n' && (strcmp(string, "native") == 0)) {
    20802080        aspect = Renderer::ASPECT_NATIVE;
    2081     } else if ((strcmp(string, "square") == 0)) {
     2081    } else if (string[0] == 's' && (strcmp(string, "square") == 0)) {
    20822082        aspect = Renderer::ASPECT_SQUARE;
    2083     } else if ((strcmp(string, "window") == 0)) {
     2083    } else if (string[0] == 'w' && (strcmp(string, "window") == 0)) {
    20842084        aspect = Renderer::ASPECT_WINDOW;
    20852085    } else {
     
    20982098    Renderer::CameraMode mode;
    20992099    const char *string = Tcl_GetString(objv[2]);
    2100     if ((strcmp(string, "persp") == 0)) {
     2100    if (string[0] == 'p' && (strcmp(string, "persp") == 0)) {
    21012101        mode = Renderer::PERSPECTIVE;
    2102     } else if ((strcmp(string, "ortho") == 0)) {
     2102    } else if (string[0] == 'o' && (strcmp(string, "ortho") == 0)) {
    21032103        mode = Renderer::ORTHO;
    2104     } else if ((strcmp(string, "image") == 0)) {
     2104    } else if (string[0] == 'i' && (strcmp(string, "image") == 0)) {
    21052105        mode = Renderer::IMAGE;
    21062106    } else {
     
    22832283
    22842284static CmdSpec cameraOps[] = {
    2285     {"aspect", 1, CameraAspectOp, 3, 3, "aspect"},
    2286     {"get",    1, CameraGetOp, 2, 2, ""},
    2287     {"mode",   1, CameraModeOp, 3, 3, "mode"},
    2288     {"orient", 3, CameraOrientOp, 6, 6, "qw qx qy qz"},
    2289     {"ortho",  1, CameraOrthoOp, 7, 7, "coordMode x y width height"},
    2290     {"pan",    1, CameraPanOp, 4, 4, "panX panY"},
    2291     {"reset",  2, CameraResetOp, 2, 3, "?all?"},
    2292     {"rotate", 2, CameraRotateOp, 5, 5, "angle angle angle"},
    2293     {"set",    1, CameraSetOp, 11, 11, "posX posY posZ focalPtX focalPtY focalPtZ viewUpX viewUpY viewUpZ"},
    2294     {"zoom",   1, CameraZoomOp, 3, 3, "zoomAmount"}
     2285    {"aspect",  1, CameraAspectOp, 3, 3, "aspect"},
     2286    {"get",     1, CameraGetOp, 2, 2, ""},
     2287    {"mode",    1, CameraModeOp, 3, 3, "mode"},
     2288    {"orient",  3, CameraOrientOp, 6, 6, "qw qx qy qz"},
     2289    {"ortho",   1, CameraOrthoOp, 7, 7, "coordMode x y width height"},
     2290    {"pan",     1, CameraPanOp, 4, 4, "panX panY"},
     2291    {"reset",   2, CameraResetOp, 2, 3, "?all?"},
     2292    {"rotate",  2, CameraRotateOp, 5, 5, "angle angle angle"},
     2293    {"set",     1, CameraSetOp, 11, 11, "posX posY posZ focalPtX focalPtY focalPtZ viewUpX viewUpY viewUpZ"},
     2294    {"zoom",    1, CameraZoomOp, 3, 3, "zoomAmount"}
    22952295};
    22962296static int nCameraOps = NumCmdSpecs(cameraOps);
     
    24852485    if (Tcl_GetIntFromObj(interp, objv[2], &numEntries) != TCL_OK) {
    24862486        const char *str = Tcl_GetString(objv[2]);
    2487         if (strcmp(str, "default") == 0) {
     2487        if (str[0] == 'd' && strcmp(str, "default") == 0) {
    24882488            numEntries = -1;
    24892489        } else {
     
    48304830{
    48314831    const char *value = Tcl_GetString(objv[2]);
    4832     if (strcmp(value, "all") == 0) {
     4832    if (value[0] == 'a' && strcmp(value, "all") == 0) {
    48334833        g_renderer->setUseCumulativeDataRange(true);
    4834     } else if (strcmp(value, "explicit") == 0) {
     4834    } else if (value[0] == 'e' && strcmp(value, "explicit") == 0) {
    48354835        if (objc < 6 || objc > 9) {
    48364836            Tcl_AppendResult(interp, "wrong number of arguments for explicit maprange", (char*)NULL);
     
    48494849        if (objc > 6) {
    48504850            const char *fieldType = Tcl_GetString(objv[6]);
    4851             if (strcmp(fieldType, "point_data") == 0) {
     4851            if (fieldType[0] == 'p' && strcmp(fieldType, "point_data") == 0) {
    48524852                type = DataSet::POINT_DATA;
    4853             } else if (strcmp(fieldType, "cell_data") == 0) {
     4853            } else if (fieldType[0] == 'c' && strcmp(fieldType, "cell_data") == 0) {
    48544854                type = DataSet::CELL_DATA;
    4855             } else if (strcmp(fieldType, "field_data") == 0) {
     4855            } else if (fieldType[0] == 'f' && strcmp(fieldType, "field_data") == 0) {
    48564856                type = DataSet::FIELD_DATA;
    48574857            } else {
     
    48724872        }
    48734873        g_renderer->setCumulativeDataRange(range, fieldName, type, numComponents, component);
    4874     } else if (strcmp(value, "separate") == 0) {
     4874    } else if (value[0] == 's' && strcmp(value, "separate") == 0) {
    48754875        g_renderer->setUseCumulativeDataRange(false);
    4876     } else if (strcmp(value, "visible") == 0) {
     4876    } else if (value[0] == 'v' && strcmp(value, "visible") == 0) {
    48774877        g_renderer->setUseCumulativeDataRange(true, true);
    48784878    } else {
     
    71057105
    71067106    proc = GetOpFromObj(interp, nImageOps, imageOps,
     7107                        CMDSPEC_ARG1, objc, objv, 0);
     7108    if (proc == NULL) {
     7109        return TCL_ERROR;
     7110    }
     7111    return (*proc) (clientData, interp, objc, objv);
     7112}
     7113
     7114static int
     7115ImageCutplaneAddOp(ClientData clientData, Tcl_Interp *interp, int objc,
     7116                   Tcl_Obj *const *objv)
     7117{
     7118    if (objc == 3) {
     7119        const char *name = Tcl_GetString(objv[2]);
     7120        if (!g_renderer->addGraphicsObject<ImageCutplane>(name)) {
     7121            Tcl_AppendResult(interp, "Failed to create imgcutplane", (char*)NULL);
     7122            return TCL_ERROR;
     7123        }
     7124    } else {
     7125        if (!g_renderer->addGraphicsObject<ImageCutplane>("all")) {
     7126            Tcl_AppendResult(interp, "Failed to create imgcutplane for one or more data sets", (char*)NULL);
     7127            return TCL_ERROR;
     7128        }
     7129    }
     7130    return TCL_OK;
     7131}
     7132
     7133static int
     7134ImageCutplaneColorOp(ClientData clientData, Tcl_Interp *interp, int objc,
     7135                     Tcl_Obj *const *objv)
     7136{
     7137    float color[3];
     7138    if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||
     7139        GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK ||
     7140        GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) {
     7141        return TCL_ERROR;
     7142    }
     7143    if (objc == 6) {
     7144        const char *name = Tcl_GetString(objv[5]);
     7145        g_renderer->setGraphicsObjectColor<ImageCutplane>(name, color);
     7146    } else {
     7147        g_renderer->setGraphicsObjectColor<ImageCutplane>("all", color);
     7148    }
     7149    return TCL_OK;
     7150}
     7151
     7152static int
     7153ImageCutplaneColorMapOp(ClientData clientData, Tcl_Interp *interp, int objc,
     7154                        Tcl_Obj *const *objv)
     7155{
     7156    const char *colorMapName = Tcl_GetString(objv[2]);
     7157    if (objc == 4) {
     7158        const char *dataSetName = Tcl_GetString(objv[3]);
     7159        g_renderer->setGraphicsObjectColorMap<ImageCutplane>(dataSetName, colorMapName);
     7160    } else {
     7161        g_renderer->setGraphicsObjectColorMap<ImageCutplane>("all", colorMapName);
     7162    }
     7163    return TCL_OK;
     7164}
     7165
     7166static int
     7167ImageCutplaneDeleteOp(ClientData clientData, Tcl_Interp *interp, int objc,
     7168                      Tcl_Obj *const *objv)
     7169{
     7170    if (objc == 3) {
     7171        const char *name = Tcl_GetString(objv[2]);
     7172        g_renderer->deleteGraphicsObject<ImageCutplane>(name);
     7173    } else {
     7174        g_renderer->deleteGraphicsObject<ImageCutplane>("all");
     7175    }
     7176    return TCL_OK;
     7177}
     7178
     7179static int
     7180ImageCutplaneMaterialOp(ClientData clientData, Tcl_Interp *interp, int objc,
     7181                        Tcl_Obj *const *objv)
     7182{
     7183    double ambient, diffuse;
     7184    if (Tcl_GetDoubleFromObj(interp, objv[2], &ambient) != TCL_OK ||
     7185        Tcl_GetDoubleFromObj(interp, objv[3], &diffuse) != TCL_OK) {
     7186        return TCL_ERROR;
     7187    }
     7188
     7189    if (objc == 5) {
     7190        const char *name = Tcl_GetString(objv[4]);
     7191        g_renderer->setGraphicsObjectAmbient<ImageCutplane>(name, ambient);
     7192        g_renderer->setGraphicsObjectDiffuse<ImageCutplane>(name, diffuse);
     7193    } else {
     7194        g_renderer->setGraphicsObjectAmbient<ImageCutplane>("all", ambient);
     7195        g_renderer->setGraphicsObjectDiffuse<ImageCutplane>("all", diffuse);
     7196    }
     7197    return TCL_OK;
     7198}
     7199
     7200static int
     7201ImageCutplaneOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc,
     7202                       Tcl_Obj *const *objv)
     7203{
     7204    double opacity;
     7205    if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) {
     7206        return TCL_ERROR;
     7207    }
     7208    if (objc == 4) {
     7209        const char *name = Tcl_GetString(objv[3]);
     7210        g_renderer->setGraphicsObjectOpacity<ImageCutplane>(name, opacity);
     7211    } else {
     7212        g_renderer->setGraphicsObjectOpacity<ImageCutplane>("all", opacity);
     7213    }
     7214    return TCL_OK;
     7215}
     7216
     7217static int
     7218ImageCutplaneOrientOp(ClientData clientData, Tcl_Interp *interp, int objc,
     7219                      Tcl_Obj *const *objv)
     7220{
     7221    double quat[4];
     7222    if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK ||
     7223        Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK ||
     7224        Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK ||
     7225        Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) {
     7226        return TCL_ERROR;
     7227    }
     7228    if (objc == 7) {
     7229        const char *name = Tcl_GetString(objv[6]);
     7230        g_renderer->setGraphicsObjectOrientation<ImageCutplane>(name, quat);
     7231    } else {
     7232        g_renderer->setGraphicsObjectOrientation<ImageCutplane>("all", quat);
     7233    }
     7234    return TCL_OK;
     7235}
     7236
     7237static int
     7238ImageCutplaneOutlineOp(ClientData clientData, Tcl_Interp *interp, int objc,
     7239                       Tcl_Obj *const *objv)
     7240{
     7241    bool state;
     7242    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     7243        return TCL_ERROR;
     7244    }
     7245    if (objc == 4) {
     7246        const char *name = Tcl_GetString(objv[3]);
     7247        g_renderer->setImageCutplaneOutlineVisibility(name, state);
     7248    } else {
     7249        g_renderer->setImageCutplaneOutlineVisibility("all", state);
     7250    }
     7251    return TCL_OK;
     7252}
     7253
     7254static int
     7255ImageCutplanePositionOp(ClientData clientData, Tcl_Interp *interp, int objc,
     7256                        Tcl_Obj *const *objv)
     7257{
     7258    double pos[3];
     7259    if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK ||
     7260        Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK ||
     7261        Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) {
     7262        return TCL_ERROR;
     7263    }
     7264    if (objc == 6) {
     7265        const char *name = Tcl_GetString(objv[5]);
     7266        g_renderer->setGraphicsObjectPosition<ImageCutplane>(name, pos);
     7267    } else {
     7268        g_renderer->setGraphicsObjectPosition<ImageCutplane>("all", pos);
     7269    }
     7270    return TCL_OK;
     7271}
     7272
     7273static int
     7274ImageCutplaneScaleOp(ClientData clientData, Tcl_Interp *interp, int objc,
     7275                     Tcl_Obj *const *objv)
     7276{
     7277    double scale[3];
     7278    if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK ||
     7279        Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK ||
     7280        Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) {
     7281        return TCL_ERROR;
     7282    }
     7283    if (objc == 6) {
     7284        const char *name = Tcl_GetString(objv[5]);
     7285        g_renderer->setGraphicsObjectScale<ImageCutplane>(name, scale);
     7286    } else {
     7287        g_renderer->setGraphicsObjectScale<ImageCutplane>("all", scale);
     7288    }
     7289    return TCL_OK;
     7290}
     7291
     7292static int
     7293ImageCutplaneSliceVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc,
     7294                               Tcl_Obj *const *objv)
     7295{
     7296    bool state;
     7297    if (GetBooleanFromObj(interp, objv[3], &state) != TCL_OK) {
     7298        return TCL_ERROR;
     7299    }
     7300    const char *string = Tcl_GetString(objv[2]);
     7301    char c = string[0];
     7302    Axis axis;
     7303    if ((c == 'x') && (strcmp(string, "x") == 0)) {
     7304        axis = X_AXIS;
     7305    } else if ((c == 'y') && (strcmp(string, "y") == 0)) {
     7306        axis = Y_AXIS;
     7307    } else if ((c == 'z') && (strcmp(string, "z") == 0)) {
     7308        axis = Z_AXIS;
     7309    } else {
     7310        Tcl_AppendResult(interp, "bad axis option \"", string,
     7311                         "\": should be axisName bool", (char*)NULL);
     7312        return TCL_ERROR;
     7313    }
     7314    if (objc == 5) {
     7315        const char *name = Tcl_GetString(objv[4]);
     7316        g_renderer->setImageCutplaneSliceVisibility(name, axis, state);
     7317    } else {
     7318        g_renderer->setImageCutplaneSliceVisibility("all", axis, state);
     7319    }
     7320    return TCL_OK;
     7321}
     7322
     7323static int
     7324ImageCutplaneVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc,
     7325                       Tcl_Obj *const *objv)
     7326{
     7327    bool state;
     7328    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     7329        return TCL_ERROR;
     7330    }
     7331    if (objc == 4) {
     7332        const char *name = Tcl_GetString(objv[3]);
     7333        g_renderer->setGraphicsObjectVisibility<ImageCutplane>(name, state);
     7334    } else {
     7335        g_renderer->setGraphicsObjectVisibility<ImageCutplane>("all", state);
     7336    }
     7337    return TCL_OK;
     7338}
     7339
     7340static int
     7341ImageCutplaneVolumeSliceOp(ClientData clientData, Tcl_Interp *interp, int objc,
     7342                           Tcl_Obj *const *objv)
     7343{
     7344    double ratio;
     7345    if (Tcl_GetDoubleFromObj(interp, objv[3], &ratio) != TCL_OK) {
     7346        return TCL_ERROR;
     7347    }
     7348    const char *string = Tcl_GetString(objv[2]);
     7349    char c = string[0];
     7350    Axis axis;
     7351    if ((c == 'x') && (strcmp(string, "x") == 0)) {
     7352        axis = X_AXIS;
     7353    } else if ((c == 'y') && (strcmp(string, "y") == 0)) {
     7354        axis = Y_AXIS;
     7355    } else if ((c == 'z') && (strcmp(string, "z") == 0)) {
     7356        axis = Z_AXIS;
     7357    } else {
     7358        Tcl_AppendResult(interp, "bad axis option \"", string,
     7359                         "\": should be axisName ratio", (char*)NULL);
     7360        return TCL_ERROR;
     7361    }
     7362    if (objc == 5) {
     7363        const char *name = Tcl_GetString(objv[4]);
     7364        g_renderer->setGraphicsObjectVolumeSlice<ImageCutplane>(name, axis, ratio);
     7365    } else {
     7366        g_renderer->setGraphicsObjectVolumeSlice<ImageCutplane>("all", axis, ratio);
     7367    }
     7368    return TCL_OK;
     7369}
     7370
     7371static CmdSpec imageCutplaneOps[] = {
     7372    {"add",          2, ImageCutplaneAddOp, 2, 3, "?dataSetName?"},
     7373    {"axis",         2, ImageCutplaneSliceVisibilityOp, 4, 5, "axis bool ?dataSetName?"},
     7374    {"color",        5, ImageCutplaneColorOp, 5, 6, "r g b ?dataSetName?"},
     7375    {"colormap",     6, ImageCutplaneColorMapOp, 3, 4, "colorMapName ?dataSetName?"},
     7376    {"delete",       1, ImageCutplaneDeleteOp, 2, 3, "?dataSetName?"},
     7377    {"material",     1, ImageCutplaneMaterialOp, 4, 5, "ambientCoeff diffuseCoeff ?dataSetName?"},
     7378    {"opacity",      2, ImageCutplaneOpacityOp, 3, 4, "value ?dataSetName?"},
     7379    {"orient",       2, ImageCutplaneOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"},
     7380    {"outline",      2, ImageCutplaneOutlineOp, 3, 4, "bool ?dataSetName?"},
     7381    {"pos",          2, ImageCutplanePositionOp, 5, 6, "x y z ?dataSetName?"},
     7382    {"scale",        2, ImageCutplaneScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
     7383    {"slice",        2, ImageCutplaneVolumeSliceOp, 4, 5, "axis ratio ?dataSetName?"},
     7384    {"visible",      1, ImageCutplaneVisibleOp, 3, 4, "bool ?dataSetName?"}
     7385};
     7386static int nImageCutplaneOps = NumCmdSpecs(imageCutplaneOps);
     7387
     7388static int
     7389ImageCutplaneCmd(ClientData clientData, Tcl_Interp *interp, int objc,
     7390                 Tcl_Obj *const *objv)
     7391{
     7392    Tcl_ObjCmdProc *proc;
     7393
     7394    proc = GetOpFromObj(interp, nImageCutplaneOps, imageCutplaneOps,
    71077395                        CMDSPEC_ARG1, objc, objv, 0);
    71087396    if (proc == NULL) {
     
    1268512973    Tcl_CreateObjCommand(interp, "heightmap",      HeightMapCmd,      clientData, NULL);
    1268612974    Tcl_CreateObjCommand(interp, "image",          ImageCmd,          clientData, NULL);
     12975    Tcl_CreateObjCommand(interp, "imgcutplane",    ImageCutplaneCmd,  clientData, NULL);
    1268712976    Tcl_CreateObjCommand(interp, "imgflush",       ImageFlushCmd,     clientData, NULL);
    1268812977    Tcl_CreateObjCommand(interp, "legend",         LegendCmd,         clientData, NULL);
     
    1272813017    Tcl_DeleteCommand(interp, "heightmap");
    1272913018    Tcl_DeleteCommand(interp, "image");
     13019    Tcl_DeleteCommand(interp, "imgcutplane");
    1273013020    Tcl_DeleteCommand(interp, "imgflush");
    1273113021    Tcl_DeleteCommand(interp, "legend");
  • trunk/packages/vizservers/vtkvis/RendererGraphicsObjs.cpp

    r4078 r4082  
    106106
    107107template<>
     108Renderer::ImageCutplaneHashmap &
     109Renderer::getGraphicsObjectHashmap<ImageCutplane>()
     110{ return _imageCutplanes; }
     111
     112template<>
    108113Renderer::LICHashmap &
    109114Renderer::getGraphicsObjectHashmap<LIC>()
     
    295300        return gobj;
    296301    }
     302    if ((gobj = getGraphicsObject<ImageCutplane>(id)) != NULL) {
     303        return gobj;
     304    }
    297305    if ((gobj = getGraphicsObject<LIC>(id)) != NULL) {
    298306        return gobj;
     
    24272435
    24282436/**
     2437 * \brief Set the visibility of cutplane outlines
     2438 */
     2439void Renderer::setImageCutplaneOutlineVisibility(const DataSetId& id, bool state)
     2440{
     2441    ImageCutplaneHashmap::iterator itr;
     2442
     2443    bool doAll = false;
     2444
     2445    if (id.compare("all") == 0) {
     2446        itr = _imageCutplanes.begin();
     2447        if (itr == _imageCutplanes.end())
     2448            return;
     2449        doAll = true;
     2450    } else {
     2451        itr = _imageCutplanes.find(id);
     2452    }
     2453
     2454    if (itr == _imageCutplanes.end()) {
     2455        ERROR("ImageCutplane not found: %s", id.c_str());
     2456        return;
     2457    }
     2458
     2459    do {
     2460        itr->second->setOutlineVisibility(state);
     2461     } while (doAll && ++itr != _imageCutplanes.end());
     2462
     2463    sceneBoundsChanged();
     2464    _needsRedraw = true;
     2465}
     2466
     2467/**
     2468 * \brief Set the visibility of slices in one of the three axes
     2469 */
     2470void Renderer::setImageCutplaneSliceVisibility(const DataSetId& id, Axis axis, bool state)
     2471{
     2472    ImageCutplaneHashmap::iterator itr;
     2473
     2474    bool doAll = false;
     2475
     2476    if (id.compare("all") == 0) {
     2477        itr = _imageCutplanes.begin();
     2478        if (itr == _imageCutplanes.end())
     2479            return;
     2480        doAll = true;
     2481    } else {
     2482        itr = _imageCutplanes.find(id);
     2483    }
     2484
     2485    if (itr == _imageCutplanes.end()) {
     2486        ERROR("ImageCutplane not found: %s", id.c_str());
     2487        return;
     2488    }
     2489
     2490    do {
     2491        itr->second->setSliceVisibility(axis, state);
     2492     } while (doAll && ++itr != _imageCutplanes.end());
     2493
     2494    sceneBoundsChanged();
     2495    _needsRedraw = true;
     2496}
     2497
     2498/**
    24292499 * \brief Create a new Line and associate it with an ID
    24302500 */
Note: See TracChangeset for help on using the changeset viewer.