当前位置: 首页>>代码示例>>C++>>正文


C++ VMDApp类代码示例

本文整理汇总了C++中VMDApp的典型用法代码示例。如果您正苦于以下问题:C++ VMDApp类的具体用法?C++ VMDApp怎么用?C++ VMDApp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了VMDApp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: get_vmdapp

// connect(host, port)
static PyObject *imdconnect(PyObject *self, PyObject *args, PyObject *keywds) {
  
  char *host;
  int port;

  static char *kwlist[] = {
    (char *)"host", (char *)"port", NULL
  };

  if (!PyArg_ParseTupleAndKeywords(args, keywds, (char *)"si", kwlist, &host, &port))
    return NULL;

  VMDApp *app = get_vmdapp();
  Molecule *mol = app->moleculeList->top();
  if (!mol) {
    PyErr_SetString(PyExc_ValueError, (char *)"No molecule loaded");
    return NULL;
  }
  if (app->imdMgr->connected()) {
    PyErr_SetString(PyExc_ValueError, (char *)"Can't create new IMD connection: already connected.");
    return NULL;
  }
  if (!app->imd_connect(mol->id(), host, port)) {
    PyErr_SetString(PyExc_ValueError, (char *)"Unable to connect to IMD server");
    return NULL;
  } 
  Py_INCREF(Py_None);
  return Py_None;
}
开发者ID:gzoppetti,项目名称:ExscitechVmd,代码行数:30,代码来源:py_imd.C

示例2: get_vmdapp

static PyObject *set_scale(PyObject *self, PyObject *args, PyObject *keywds) {
  static char *kwlist[] = {
    (char *)"method", (char *)"midpoint", (char *)"min", (char *)"max", NULL
  };

  char *method = NULL;
  float midpoint = -1, min = -1, max = -1;
  VMDApp *app = get_vmdapp();
  app->colorscale_info(&midpoint, &min, &max);
 
  if (!PyArg_ParseTupleAndKeywords(args, keywds, (char *)"|sfff", kwlist,
                                   &method, &midpoint, &min, &max)) 
    return NULL; 

  if (method) {
    int ind = app->colorscale_method_index(method);
    if (ind < 0) { 
      PyErr_SetString(PyExc_ValueError, (char *)"Invalid color scale method");
      return NULL;
    }
    app->colorscale_setmethod(ind);
  }
  app->colorscale_setvalues(midpoint, min, max);  
  Py_INCREF(Py_None);
  return Py_None;
}
开发者ID:gzoppetti,项目名称:ExscitechVmd,代码行数:26,代码来源:py_color.C

示例3: py_scale_methods

static PyObject* py_scale_methods(PyObject *self, PyObject *args)
{

  PyObject *newlist = NULL;
  VMDApp *app;
  int i, num;

  if (!(app = get_vmdapp()))
    return NULL;

  num = app->num_colorscale_methods();
  if (!(newlist = PyList_New(num)))
    goto failure;

  for (i = 0; i < num; i++) {
    PyList_SET_ITEM(newlist, i, as_pystring(app->colorscale_method_name(i)));
    if (PyErr_Occurred())
      goto failure;
  }

  return newlist;

failure:
  PyErr_SetString(PyExc_RuntimeError, "Problem listing colorscales");
  Py_XDECREF(newlist);
  return NULL;
}
开发者ID:Eigenstate,项目名称:vmd-python,代码行数:27,代码来源:py_color.C

示例4: savefile_cb

void MainFltkMenu::savefile_cb(Fl_Widget *w, void *v) {
  VMDApp *app = (VMDApp *)(w->user_data());
  int selmol = ((MainFltkMenu *) v)->get_selected_molecule();
  app->menu_select_mol("save", selmol);
  app->menu_show("save", 0);
  app->menu_show("save", 1);
}
开发者ID:VictorMion,项目名称:vmd-cvs-github,代码行数:7,代码来源:MainFltkMenu.C

示例5: py_set_colorid

static PyObject* py_set_colorid(PyObject *self, PyObject *args,
                                PyObject *kwargs)
{
  const char *kwnames[] = {"id", "rgb", NULL};
  float rgb[3];
  int colorid;
  VMDApp *app;

  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i(fff):color.set_colorid",
                                   (char**) kwnames, &colorid, &rgb[0], &rgb[1],
                                   &rgb[2]))
  	return NULL;

  if (!(app = get_vmdapp()))
    return NULL;

  if (colorid >= app->num_regular_colors() || colorid < 0) {
  	PyErr_Format(PyExc_ValueError, "color index '%d' out of range", colorid);
  	return NULL;
  }

  app->color_change_rgb(app->color_name(colorid), rgb[0], rgb[1], rgb[2]);
  Py_INCREF(Py_None);
  return Py_None;
}
开发者ID:Eigenstate,项目名称:vmd-python,代码行数:25,代码来源:py_color.C

示例6: py_set_scale

static PyObject* py_set_scale(PyObject *self, PyObject *args, PyObject *kwargs)
{

  const char *kwnames[] = {"method", "midpoint", "min", "max", NULL};
  float midpoint = -1, min = -1, max = -1;
  char *method = NULL;
  VMDApp *app;

  // Set midpoint, min and max to the current values
  if (!(app = get_vmdapp()))
    return NULL;
  app->colorscale_info(&midpoint, &min, &max);

  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|zfff:color.set_scale",
                                   (char**) kwnames, &method, &midpoint, &min,
                                   &max))
    return NULL;

  if (method) {
    int ind = app->colorscale_method_index(method);
    if (ind < 0) {
      PyErr_SetString(PyExc_ValueError, "Invalid color scale method");
      return NULL;
    }
    app->colorscale_setmethod(ind);
  }
  app->colorscale_setvalues(midpoint, min, max);

  Py_INCREF(Py_None);
  return Py_None;
}
开发者ID:Eigenstate,项目名称:vmd-python,代码行数:31,代码来源:py_color.C

示例7: mol_from_id

// colors: Takes one argument, either a tuple of three floats, a string 
// color name, or an integer color index 
static PyObject *graphics_color(PyObject *self, PyObject *args) {
  int id;
  PyObject *obj;
  int result = -1;
  
  if (!PyArg_ParseTuple(args, (char *)"iO:graphics.color", &id, &obj))
    return NULL;

  MoleculeGraphics *mol = mol_from_id(id);
  if (!mol) 
    return NULL;
  
  if (PyInt_Check(obj)) {
    int index = PyInt_AsLong(obj);
    if (index >= 0 && index < MAXCOLORS) 
      result = mol->use_color(index);

  } else if (PyString_Check(obj)) { 
    char *name = PyString_AsString(obj);
    VMDApp *app = get_vmdapp();
    int index = app->color_index(name);
    if (index >= 0) 
      result = mol->use_color(index);
  }

  if (result >= 0)
    return PyInt_FromLong(result);

  PyErr_SetString(PyExc_ValueError, (char *)"Invalid color");
  return NULL;
}  
开发者ID:gzoppetti,项目名称:ExscitechVmd,代码行数:33,代码来源:py_graphics.C

示例8: get_vmdapp

// 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;
} 
开发者ID:VictorMion,项目名称:vmd-cvs-github,代码行数:27,代码来源:py_label.C

示例9: reverse_cb

static void reverse_cb(Fl_Widget *w, void *v) {
  Fl_Button *button = (Fl_Button *)w;
  VMDApp *app = (VMDApp *)v;
  if (button->value())
    app->animation_set_dir(Animation::ANIM_REVERSE);
  else
    app->animation_set_dir(Animation::ANIM_PAUSE);
}
开发者ID:VictorMion,项目名称:vmd-cvs-github,代码行数:8,代码来源:MainFltkMenu.C

示例10: forward_cb

static void forward_cb(Fl_Widget *w, void *v) {
  Fl_Button *button = (Fl_Button *)w;
  VMDApp *app = (VMDApp *)v;
  if (button->value())
    app->animation_set_dir(Animation::ANIM_FORWARD);
  else
    app->animation_set_dir(Animation::ANIM_PAUSE);
}
开发者ID:VictorMion,项目名称:vmd-cvs-github,代码行数:8,代码来源:MainFltkMenu.C

示例11: curframe_cb

static void curframe_cb(Fl_Widget *w, void *v) {
  Fl_Input *inp = (Fl_Input *)w;
  VMDApp *app = (VMDApp *)v;
  int val = atoi(inp->value());
  int max = app->molecule_numframes(app->molecule_top());
  if (val < 0) val = 0;
  if (val >= max) val = max-1;
  app->animation_set_frame(val);
}
开发者ID:VictorMion,项目名称:vmd-cvs-github,代码行数:9,代码来源:MainFltkMenu.C

示例12: stereoswap_cb

static void stereoswap_cb(Fl_Widget *w, void *v) {
  Fl_Menu_ *m = (Fl_Menu_ *)w;
  VMDApp *app = (VMDApp *)v;
  if (!strcmp("On", m->text())) {
    app->display_set_stereo_swap(1);
  } else {
    app->display_set_stereo_swap(0);
  }
}
开发者ID:VictorMion,项目名称:vmd-cvs-github,代码行数:9,代码来源:MainFltkMenu.C

示例13: backgroundmode_cb

static void backgroundmode_cb(Fl_Widget *w, void *v) {
  Fl_Menu_ *m = (Fl_Menu_ *)w;
  VMDApp *app = (VMDApp *)(w->user_data());
  if (!strcmp("Gradient", m->text())) {
    app->display_set_background_mode(1);
  } else {
    app->display_set_background_mode(0);
  }
}
开发者ID:VictorMion,项目名称:vmd-cvs-github,代码行数:9,代码来源:MainFltkMenu.C

示例14: get_vmdapp

static PyObject *py_vmdupdate(PyObject *self, PyObject *args) {
  VMDApp *app = get_vmdapp();
  if (!app) {
    fprintf(stderr, "no app!!\n");
    Py_INCREF(Py_None);
    return Py_None; 
  }
  return Py_BuildValue("i", app->VMDupdate(1));
}
开发者ID:tmd-gpat,项目名称:MOLding,代码行数:9,代码来源:py_vmd.C

示例15: shadowmode_cb

static void shadowmode_cb(Fl_Widget *w, void *v) {
  const char *mode = ((Fl_Choice *)w)->text();
  VMDApp *app = (VMDApp *)v;
  if (!strcmp(mode, "On")) {
    app->display_set_shadows(1);
  } else {
    app->display_set_shadows(0);
  }
}
开发者ID:VictorMion,项目名称:vmd-cvs-github,代码行数:9,代码来源:DisplayFltkMenu.C


注:本文中的VMDApp类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。