Source: xdrawchem
Tags: patch
Control: block 948477 by -1

Hello,

I have prepared an NMU containing a patch to make xdrawchem build with
Open Babel 3.

Best,
Andrius

diff -Nru xdrawchem-1.10.2.1/debian/changelog 
xdrawchem-1.10.2.1/debian/changelog
--- xdrawchem-1.10.2.1/debian/changelog 2019-01-01 10:30:37.000000000 -0500
+++ xdrawchem-1.10.2.1/debian/changelog 2020-01-13 02:05:28.000000000 -0500
@@ -1,3 +1,10 @@
+xdrawchem (1:1.10.2.1-2.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Porting to Open Babel 3.
+
+ -- Andrius Merkys <mer...@debian.org>  Mon, 13 Jan 2020 02:05:28 -0500
+
 xdrawchem (1:1.10.2.1-2) unstable; urgency=medium
 
   * updated Standards-Version and dh level
diff -Nru xdrawchem-1.10.2.1/debian/patches/openbabel3.patch 
xdrawchem-1.10.2.1/debian/patches/openbabel3.patch
--- xdrawchem-1.10.2.1/debian/patches/openbabel3.patch  1969-12-31 
19:00:00.000000000 -0500
+++ xdrawchem-1.10.2.1/debian/patches/openbabel3.patch  2020-01-08 
04:38:17.000000000 -0500
@@ -0,0 +1,155 @@
+--- a/xdrawchem.pro
++++ b/xdrawchem.pro
+@@ -2,8 +2,8 @@
+ TARGET = xdrawchem
+ 
+ # edit to match your OB install
+-exists(/usr/include/openbabel-2.0/openbabel/mol.h) {
+-INCLUDEPATH += /usr/include/openbabel-2.0
++exists(/usr/include/openbabel3/openbabel/mol.h) {
++INCLUDEPATH += /usr/include/openbabel3
+ LIBS += -lopenbabel
+ }
+ exists(/usr/local/include/openbabel-2.0/openbabel/mol.h) {
+--- a/xdrawchem/ioiface.h
++++ b/xdrawchem/ioiface.h
+@@ -20,6 +20,9 @@
+ 
+ #include "chemdata.h"
+ 
++#include <openbabel/atom.h>
++#include <openbabel/bond.h>
++#include <openbabel/math/vector3.h>
+ #include <openbabel/mol.h>
+ 
+ using namespace OpenBabel;
+--- a/xdrawchem/ioiface.cpp
++++ b/xdrawchem/ioiface.cpp
+@@ -193,7 +193,7 @@
+         int bondorder = bond->GetBondOrder();
+ 
+         //set elements
+-        if ( !atom1->IsCarbon() ) {
++        if ( atom1->GetAtomicNum() != 6 ) {
+             QString str( "<element>" );
+             str += IOIface::symbol[atom1->GetAtomicNum() - 1];
+             str += "</element>";
+@@ -201,7 +201,7 @@
+ 
+         }
+ 
+-        if ( !atom2->IsCarbon() ) {
++        if ( atom2->GetAtomicNum() != 6 ) {
+             QString str( "<element>" );
+ 
+             str += IOIface::symbol[atom2->GetAtomicNum() - 1];
+@@ -216,7 +216,7 @@
+ 
+         //label atoms if not Carbon
+ 
+-        if ( !atom1->IsCarbon() ) {
++        if ( atom1->GetAtomicNum() != 6 ) {
+ 
+             text = new Text( chemdata->getRender2D() );
+             QString str = IOIface::symbol[atom1->GetAtomicNum() - 1];
+@@ -229,7 +229,7 @@
+             //qDebug() << "ioiface(1) text:" << str;
+         }
+ 
+-        if ( !atom2->IsCarbon() ) {
++        if ( atom2->GetAtomicNum() != 6 ) {
+ 
+             text = new Text( chemdata->getRender2D() );
+             QString str = IOIface::symbol[atom2->GetAtomicNum() - 1];
+--- a/xdrawchem/molecule.h
++++ b/xdrawchem/molecule.h
+@@ -3,6 +3,10 @@
+ #ifndef MOLECULE_H
+ #define MOLECULE_H
+ 
++#include <openbabel/atom.h>
++#include <openbabel/bond.h>
++#include <openbabel/elements.h>
++#include <openbabel/math/vector3.h>
+ #include <openbabel/mol.h>
+ #include <openbabel/obconversion.h>
+ 
+--- a/xdrawchem/molecule_obmol.cpp
++++ b/xdrawchem/molecule_obmol.cpp
+@@ -58,7 +58,7 @@
+     Point point;
+     Text *text;
+ 
+-    std::vector < OBEdgeBase * >::iterator bonditr;
++    std::vector < OBBond * >::iterator bonditr;
+     std::map < Point, DPoint *, pt_cmp > points;
+     std::map < Point, DPoint *, pt_cmp >::iterator itr;
+ 
+@@ -133,7 +133,7 @@
+         int bondorder = bond->GetBondOrder();
+ 
+         //set elements
+-        if ( !atom1->IsCarbon() ) {
++        if ( atom1->GetAtomicNum() != 6 ) {
+             QString str( "<element>" );
+ 
+             str += symbol[atom1->GetAtomicNum() - 1];
+@@ -142,7 +142,7 @@
+ 
+         }
+ 
+-        if ( !atom2->IsCarbon() ) {
++        if ( atom2->GetAtomicNum() != 6 ) {
+             QString str( "<element>" );
+ 
+             str += symbol[atom2->GetAtomicNum() - 1];
+@@ -155,7 +155,7 @@
+ 
+         //label atoms if not Carbon
+ 
+-        if ( !atom1->IsCarbon() ) {
++        if ( atom1->GetAtomicNum() != 6 ) {
+ 
+             text = new Text( r );
+             QString str = symbol[atom1->GetAtomicNum() - 1];
+@@ -167,7 +167,7 @@
+             addText( text );
+         }
+ 
+-        if ( !atom2->IsCarbon() ) {
++        if ( atom2->GetAtomicNum() != 6 ) {
+ 
+             text = new Text( r );
+             QString str = symbol[atom2->GetAtomicNum() - 1];
+--- a/xdrawchem/molecule_smiles.cpp
++++ b/xdrawchem/molecule_smiles.cpp
+@@ -254,8 +254,6 @@
+ 
+     DPoint *thisDPoint;
+ 
+-    OpenBabel::OBElementTable etable;
+-
+     std::vector < OpenBabel::OBNodeBase * >::iterator ait;
+ 
+     std::map < OpenBabel::OBAtom *, DPoint * >hashit;
+@@ -265,9 +263,9 @@
+ 
+         qInfo() << "Adding OBAtom: " << i++ << " of element#: " <<
+           thisAtom->GetAtomicNum() << " type: " <<
+-          etable.GetSymbol(thisAtom->GetAtomicNum()) ;
++          OBElements::GetSymbol(thisAtom->GetAtomicNum()) ;
+         thisDPoint = new DPoint;
+-        tmp_element = etable.GetSymbol( thisAtom->GetAtomicNum() );
++        tmp_element = OBElements::GetSymbol( thisAtom->GetAtomicNum() );
+ 
+         tmp_element_mask = tmp_element;
+         tmp_element_mask.fill( ' ' );   // fix the mask characters
+@@ -292,7 +290,7 @@
+ 
+     OpenBabel::OBBond * thisBond;
+ 
+-    std::vector < OpenBabel::OBEdgeBase * >::iterator bit;
++    std::vector < OpenBabel::OBBond * >::iterator bit;
+     for ( thisBond = myMol.BeginBond( bit ); thisBond; thisBond = 
myMol.NextBond( bit ) ) {
+         addBond( hashit[thisBond->GetBeginAtom()], 
hashit[thisBond->GetEndAtom()], 1, thisBond->GetBondOrder(), QColor( 0, 0, 0 ), 
true );
+     }
diff -Nru xdrawchem-1.10.2.1/debian/patches/series 
xdrawchem-1.10.2.1/debian/patches/series
--- xdrawchem-1.10.2.1/debian/patches/series    1969-12-31 19:00:00.000000000 
-0500
+++ xdrawchem-1.10.2.1/debian/patches/series    2020-01-08 01:26:58.000000000 
-0500
@@ -0,0 +1 @@
+openbabel3.patch

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to