From 64397c2dbf6e13110a2ab98b165af57782524f91 Mon Sep 17 00:00:00 2001 From: fps Date: Fri, 13 Sep 2013 15:59:18 +0000 Subject: [PATCH] add swig for XAO --- Makefile.am | 3 ++ configure.ac | 1 + src/Makefile.am | 2 +- src/XAO_Swig/Makefile.am | 53 ++++++++++++++++++++++++++++++++ src/XAO_Swig/xao.py | 28 +++++++++++++++++ src/XAO_Swig/xao_swig.i | 65 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 src/XAO_Swig/Makefile.am create mode 100644 src/XAO_Swig/xao.py create mode 100644 src/XAO_Swig/xao_swig.i diff --git a/Makefile.am b/Makefile.am index 863140fa7..a04373716 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,3 +56,6 @@ docs: usr_docs dev_docs: (cd doc && $(MAKE) $(AM_MAKEFLAGS) dev_docs) + +unittest: + ( ./src/XAO/tests/TestXAO ) diff --git a/configure.ac b/configure.ac index 13db63495..0fc06936a 100644 --- a/configure.ac +++ b/configure.ac @@ -505,6 +505,7 @@ AC_OUTPUT([ \ src/AdvancedGUI/Makefile \ src/XAO/Makefile \ src/XAO/tests/Makefile \ + src/XAO_Swig/Makefile \ src/ImportExportGUI/Makefile \ src/ARCHIMEDE/Makefile \ src/BREPExport/Makefile \ diff --git a/src/Makefile.am b/src/Makefile.am index 0ca45f805..e3eb2bd47 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,7 +23,7 @@ SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo SKETCHER OCC2VTK GEOM \ BREPExport BREPImport IGESExport IGESImport STEPExport \ - STEPImport STLExport VTKExport ShHealOper XAO GEOMImpl GEOM_I \ + STEPImport STLExport VTKExport ShHealOper XAO XAO_Swig GEOMImpl GEOM_I \ GEOMClient GEOM_I_Superv GEOM_SWIG GEOM_PY if WITH_OPENCV diff --git a/src/XAO_Swig/Makefile.am b/src/XAO_Swig/Makefile.am new file mode 100644 index 000000000..b95f8a5c0 --- /dev/null +++ b/src/XAO_Swig/Makefile.am @@ -0,0 +1,53 @@ +# Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +# this option puts it to dist +#BUILT_SOURCES = swig_wrap.cpp + +SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir)/../XAO +SWIG_SOURCES = xao_swig.i + +# Libraries targets +lib_LTLIBRARIES = _xao_swig.la +_xao_swig_la_SOURCES = $(SWIG_SOURCES) +nodist__xao_swig_la_SOURCES = swig_wrap.cpp +nodist_salomescript_DATA = xao_swig.py + +dist_salomescript_PYTHON = xao.py + +EXTRA_DIST += $(SWIG_SOURCES) + +xao_swig.py: swig_wrap.cpp + +_xao_swig_la_CPPFLAGS = \ + $(PYTHON_INCLUDES) \ + $(CAS_CPPFLAGS) \ + -I$(srcdir)/../XAO \ + -I$(top_builddir)/idl + +_xao_swig_la_LDFLAGS = -module +_xao_swig_la_LIBADD = \ + ../XAO/libXAO.la + +swig_wrap.cpp : $(SWIG_SOURCES) + $(SWIG) $(SWIG_FLAGS) -o $@ $< + +CLEANFILES = swig_wrap.cpp xao_swig.py diff --git a/src/XAO_Swig/xao.py b/src/XAO_Swig/xao.py new file mode 100644 index 000000000..431bc0457 --- /dev/null +++ b/src/XAO_Swig/xao.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# -*- coding: iso-8859-1 -*- + +from xao_swig import * + +#from xao_swig import BOOLEAN, INTEGER, DOUBLE, STRING +#from xao_swig import VERTEX, EDGE, FACE, SOLID, WHOLE +#from xao_swig import BREP, STEP + +#from xao_swig import VectorBoolean, VectorDouble, VectorInteger, VectorString, VectorStep +#from xao_swig import VectorVectorBoolean, VectorVectorDouble, VectorVectorInteger, VectorVectorString +#from xao_swig import ListField, ListGroup, SetInt + +#from xao_swig import Field, BooleanField, IntegerField, DoubleField, StringField +#from xao_swig import Step, BooleanStep, IntegerStep, DoubleStep, StringStep +#from xao_swig import Xao, Group, Geometry, GeometricElement + +#from xao_swig import XAO_Exception + +#from xao_swig import BrepGeometry as _BrepGeometry + +#class BrepGeometry(_BrepGeometry): +# def setShape(self, shape): +# if shape is not None and 'GetShapeStream' in dir(shape): +# _BrepGeometry.setShape(self, shape.GetShapeStream()) +# else: +# raise XAO_Exception("toto") + diff --git a/src/XAO_Swig/xao_swig.i b/src/XAO_Swig/xao_swig.i new file mode 100644 index 000000000..01df965dc --- /dev/null +++ b/src/XAO_Swig/xao_swig.i @@ -0,0 +1,65 @@ +%module xao_swig +%{ +#include "XAO_Exception.hxx" +#include "XAO_XaoUtils.hxx" +#include "XAO_Xao.hxx" +#include "XAO_GeometricElement.hxx" +#include "XAO_Geometry.hxx" +#include "XAO_BrepGeometry.hxx" +#include "XAO_Group.hxx" +#include "XAO_Field.hxx" +#include "XAO_Step.hxx" +#include "XAO_BooleanField.hxx" +#include "XAO_DoubleField.hxx" +#include "XAO_IntegerField.hxx" +#include "XAO_StringField.hxx" +#include "XAO_BooleanStep.hxx" +#include "XAO_DoubleStep.hxx" +#include "XAO_IntegerStep.hxx" +#include "XAO_StringStep.hxx" +%} + +%include "std_string.i" +%include "std_vector.i" +%include "std_list.i" +%include "std_map.i" +%include "std_set.i" +namespace std +{ +%template(ListGroup) list; +%template(ListField) list; +%template(VectorStep) vector; +%template(SetInt) set; + +%template(VectorBoolean) vector; +%template(VectorInteger) vector; +%template(VectorDouble) vector; +%template(VectorString) vector; + +%template(VectorVectorBoolean) vector< vector >; +%template(VectorVectorInteger) vector< vector >; +%template(VectorVectorDouble) vector< vector >; +%template(VectorVectorString) vector< vector >; +} + +%include XAO_Exception.hxx +%include XAO_XaoUtils.hxx + +%include XAO_Step.hxx +%include XAO_BooleanStep.hxx +%include XAO_DoubleStep.hxx +%include XAO_IntegerStep.hxx +%include XAO_StringStep.hxx + +%include XAO_Field.hxx +%include XAO_BooleanField.hxx +%include XAO_DoubleField.hxx +%include XAO_IntegerField.hxx +%include XAO_StringField.hxx + +%include XAO_Group.hxx + +%include XAO_GeometricElement.hxx +%include XAO_Geometry.hxx +%include XAO_BrepGeometry.hxx +%include XAO_Xao.hxx -- 2.39.2