1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
Description: Update plugin to build with OpenBabel 3.x API
Quick and dirty porting of the plugin to the new API.
Author: Stuart Prescott <stuart@debian.org>
diff --git a/lib/plug-ins/OpenBabel-wrapper/ob_basic.cpp b/lib/plug-ins/OpenBabel-wrapper/ob_basic.cpp
index 8b07b29..f4d3fcb 100644
--- a/lib/plug-ins/OpenBabel-wrapper/ob_basic.cpp
+++ b/lib/plug-ins/OpenBabel-wrapper/ob_basic.cpp
@@ -5,6 +5,11 @@
#include <openbabel/mol.h>
#include <openbabel/math/matrix3x3.h>
#include <openbabel/math/vector3.h>
+#include <openbabel/elements.h>
+#include <openbabel/atom.h>
+#include <openbabel/bond.h>
+#include <openbabel/generic.h>
+#include <openbabel/obiter.h>
#include <visu_tools.h>
#include <visu_basic.h>
@@ -90,7 +95,7 @@ const char* obloaderGet_icon()
static char* getSymbol(OpenBabel::OBAtom *atom)
{
- return (char*)etab.GetSymbol(atom->GetAtomicNum());
+ return (char*) OBElements::GetSymbol(atom->GetAtomicNum());
}
static void addNode(GList **lst, OpenBabel::OBAtom *atom)
@@ -144,7 +149,6 @@ static gboolean loadOpenBabelFile(VisuData *data, const gchar* filename,
guint ntype;
OpenBabel::OBUnitCell *uc;
double rprimdFull[9], rprimd[3][3];
- std::vector<double> eleRGB;
float xyz[3], xyz0[3], length, lengthMin, lengthMax;
GList *pairs;
gchar *infoUTF8;
@@ -249,14 +253,15 @@ static gboolean loadOpenBabelFile(VisuData *data, const gchar* filename,
if (newEle)
{
// We use the standard OB colours.
- eleRGB = etab.GetRGB(((OpenBabel::OBAtom*)lstatom->data)->GetAtomicNum());
- ele1->rgb[0] = eleRGB[0];
- ele1->rgb[1] = eleRGB[1];
- ele1->rgb[2] = eleRGB[2];
+ double *red, *green, *blue;
+ OBElements::GetRGB(((OpenBabel::OBAtom*)lstatom->data)->GetAtomicNum(), red, green, blue);
+ ele1->rgb[0] = *red;
+ ele1->rgb[1] = *green;
+ ele1->rgb[2] = *blue;
tool_color_addFloatRGBA(ele1->rgb, NULL);
// We use standard radius for element.
radius =
- etab.GetCovalentRad(((OpenBabel::OBAtom*)lstatom->data)->GetAtomicNum());
+ OBElements::GetCovalentRad(((OpenBabel::OBAtom*)lstatom->data)->GetAtomicNum());
visu_rendering_atomic_setRadius(ele1, (float)radius);
}
nNodes = g_list_length(lstatom);
@@ -391,7 +396,7 @@ static gboolean saveOpenBabelFile(ToolFileFormat *format _U_, const char* filena
visu_node_array_iterNext(VISU_NODE_ARRAY(dataObj), &iter))
{
atom = mol->NewAtom();
- atom->SetAtomicNum(etab.GetAtomicNum(iter.element->name));
+ atom->SetAtomicNum(OBElements::GetAtomicNum(iter.element->name));
visu_data_getNodePosition(dataObj, iter.node, coord);
atom->SetVector((double)coord[0], (double)coord[1], (double)coord[2]);
}
|