Changeset 3134 for trunk


Ignore:
Timestamp:
Aug 2, 2012 7:22:21 PM (12 years ago)
Author:
ldelgass
Message:

Add protocol to toggle atom labels

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

Legend:

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

    r3133 r3134  
    444444    void setMoleculeAtomVisibility(const DataSetId& id, bool state);
    445445
     446    void setMoleculeAtomLabelVisibility(const DataSetId& id, bool state);
     447
    446448    void setMoleculeBondVisibility(const DataSetId& id, bool state);
    447449
  • trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp

    r3126 r3134  
    34883488
    34893489static int
     3490MoleculeAtomLabelVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc,
     3491                              Tcl_Obj *const *objv)
     3492{
     3493    bool state;
     3494    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     3495        return TCL_ERROR;
     3496    }
     3497    if (objc == 4) {
     3498        const char *name = Tcl_GetString(objv[3]);
     3499        g_renderer->setMoleculeAtomLabelVisibility(name, state);
     3500    } else {
     3501        g_renderer->setMoleculeAtomLabelVisibility("all", state);
     3502    }
     3503    return TCL_OK;
     3504}
     3505
     3506static int
    34903507MoleculeAtomScaleFactorOp(ClientData clientData, Tcl_Interp *interp, int objc,
    34913508                          Tcl_Obj *const *objv)
     
    38263843    {"delete",     1, MoleculeDeleteOp, 2, 3, "?dataSetName?"},
    38273844    {"edges",      1, MoleculeEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"},
     3845    {"labels",     2, MoleculeAtomLabelVisibilityOp, 3, 4, "bool ?dataSetName?"},
    38283846    {"lighting",   3, MoleculeLightingOp, 3, 4, "bool ?dataSetName?"},
    38293847    {"linecolor",  5, MoleculeLineColorOp, 5, 6, "r g b ?dataSetName?"},
  • trunk/packages/vizservers/vtkvis/RpVtkRendererGraphicsObjs.cpp

    r3126 r3134  
    11731173
    11741174/**
     1175 * \brief Turn on/off rendering of the Molecule atom labels for the given DataSet
     1176 */
     1177void Renderer::setMoleculeAtomLabelVisibility(const DataSetId& id, bool state)
     1178{
     1179    MoleculeHashmap::iterator itr;
     1180
     1181    bool doAll = false;
     1182
     1183    if (id.compare("all") == 0) {
     1184        itr = _molecules.begin();
     1185        doAll = true;
     1186    } else {
     1187        itr = _molecules.find(id);
     1188    }
     1189    if (itr == _molecules.end()) {
     1190        ERROR("Molecule not found: %s", id.c_str());
     1191        return;
     1192    }
     1193
     1194    do {
     1195        itr->second->setAtomLabelVisibility(state);
     1196    } while (doAll && ++itr != _molecules.end());
     1197
     1198    _needsRedraw = true;
     1199}
     1200
     1201/**
    11751202 * \brief Set radius scale factor for atoms
    11761203 */
  • trunk/packages/vizservers/vtkvis/protocol.txt

    r3126 r3134  
    288288molecule delete <?datasetName?>
    289289molecule edges <bool> <?datasetName?>
     290molecule labels <bool> <?datasetName?>
    290291molecule lighting <bool> <?datasetName?>
    291292molecule linecolor <r> <g> <b> <?datasetName?>
Note: See TracChangeset for help on using the changeset viewer.