本文整理汇总了C++中VMDApp::label_delete方法的典型用法代码示例。如果您正苦于以下问题:C++ VMDApp::label_delete方法的具体用法?C++ VMDApp::label_delete怎么用?C++ VMDApp::label_delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VMDApp
的用法示例。
在下文中一共展示了VMDApp::label_delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// delete(category, labeldict)
// XXX cut 'n paste from show...
static PyObject *label_delete(PyObject *self, PyObject *args) {
char *type;
PyObject *labeldict;
if (!PyArg_ParseTuple(args, (char *)"sO!:label.delete",
&type, &PyDict_Type, &labeldict))
return NULL;
VMDApp *app = get_vmdapp();
int cat = app->geometryList->geom_list_index(type);
if (cat < 0) {
PyErr_SetString(PyExc_ValueError, (char *)"Unknown label category");
return NULL;
}
GeomListPtr glist = app->geometryList->geom_list(cat);
int gnum = glist->num();
for (int i=0; i<gnum; i++) {
if (dict2geom(labeldict, (*glist)[i])) {
app->label_delete(type, i); // XXX check return code
Py_INCREF(Py_None);
return Py_None;
}
}
PyErr_SetString(PyExc_ValueError, "Invalid labeldict.");
return NULL;
}
示例2: text_cmd_label
//.........这里部分代码省略.........
return TCL_OK;
} else
return TCL_ERROR;
} else if(!strupncmp(argv[1], "show", CMDLEN) ||
!strupncmp(argv[1], "hide", CMDLEN)) {
int item;
if(argc == 3 || (argc == 4 && !strupncmp(argv[3], "all", CMDLEN)))
item = (-1);
else if(argc == 4) {
if (Tcl_GetInt(interp, argv[3], &item) != TCL_OK) {
Tcl_AppendResult(interp, " in label ", argv[1], NULL);
return TCL_ERROR;
}
} else
return TCL_ERROR;
app->label_show(argv[2], item, !strupncmp(argv[1], "show", CMDLEN));
// XXX check return code
} else if(!strupncmp(argv[1], "delete", CMDLEN)) {
int item;
if(argc == 3 || (argc == 4 && !strupncmp(argv[3], "all", CMDLEN))) {
item = (-1);
} else if(argc == 4) {
if (Tcl_GetInt(interp, argv[3], &item) != TCL_OK) {
Tcl_AppendResult(interp, " in label ", argv[1], NULL);
return TCL_ERROR;
}
} else {
return TCL_ERROR;
}
app->label_delete(argv[2], item);
// XXX check return code
} else if(!strupncmp(argv[1], "graph", CMDLEN) && argc > 3) {
int item;
if (Tcl_GetInt(interp, argv[3], &item) != TCL_OK) {
return TCL_ERROR;
};
// find the geometry
int cat = app->geometryList->geom_list_index(argv[2]);
if (cat < 0) {
Tcl_AppendResult(interp, "Invalid geometry type: ", argv[2], NULL);
return TCL_ERROR;
}
// get the correct geometry pointer
GeomListPtr glist = app->geometryList -> geom_list(cat);
int gnum = glist -> num();
if (item < 0 || item >= gnum) {
sprintf(interp -> result, "label %s index %d out of range",
argv[2], item);
return TCL_ERROR;
}
// compute all the values
GeometryMol *g = (*glist)[item];
if (!g->has_value()) {
Tcl_AppendResult(interp, "Geometry type ", argv[2], " has no values to graph.", NULL);
return TCL_ERROR;
}
ResizeArray<float> gValues(1024);
if (!g->calculate_all(gValues)) {
interp->result = (char *) "label has no value";
return TCL_ERROR;
}