add swig for XAO

This commit is contained in:
fps 2013-09-13 15:59:18 +00:00
parent b90ae66f7d
commit 64397c2dbf
6 changed files with 151 additions and 1 deletions

View File

@ -56,3 +56,6 @@ docs: usr_docs
dev_docs:
(cd doc && $(MAKE) $(AM_MAKEFLAGS) dev_docs)
unittest:
( ./src/XAO/tests/TestXAO )

View File

@ -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 \

View File

@ -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

53
src/XAO_Swig/Makefile.am Normal file
View File

@ -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

28
src/XAO_Swig/xao.py Normal file
View File

@ -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")

65
src/XAO_Swig/xao_swig.i Normal file
View File

@ -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<XAO::Group*>;
%template(ListField) list<XAO::Field*>;
%template(VectorStep) vector<XAO::Step*>;
%template(SetInt) set<int>;
%template(VectorBoolean) vector<bool>;
%template(VectorInteger) vector<int>;
%template(VectorDouble) vector<double>;
%template(VectorString) vector<string>;
%template(VectorVectorBoolean) vector< vector<bool> >;
%template(VectorVectorInteger) vector< vector<int> >;
%template(VectorVectorDouble) vector< vector<double> >;
%template(VectorVectorString) vector< vector<string> >;
}
%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