Box and contact are cleaned : no direct use of converter
This commit is contained in:
parent
61a58ff3d6
commit
96c031c224
|
@ -1,40 +1,3 @@
|
||||||
|
|
||||||
// -*- C++ -*-
|
|
||||||
//
|
|
||||||
// This file is part of the Coriolis Project.
|
|
||||||
// Copyright (C) Laboratoire LIP6 - Departement ASIM
|
|
||||||
// Universite Pierre et Marie Curie
|
|
||||||
//
|
|
||||||
// Main contributors :
|
|
||||||
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
|
|
||||||
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
|
|
||||||
// Hugo Clément <Hugo.Clement@lip6.fr>
|
|
||||||
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
|
|
||||||
// Damien Dupuis <Damien.Dupuis@lip6.fr>
|
|
||||||
// Christian Masson <Christian.Masson@lip6.fr>
|
|
||||||
// Marek Sroka <Marek.Sroka@lip6.fr>
|
|
||||||
//
|
|
||||||
// The Coriolis Project is free software; you can redistribute it
|
|
||||||
// and/or modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2 of
|
|
||||||
// the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// The Coriolis Project 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 General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with the Coriolis Project; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
// USA
|
|
||||||
//
|
|
||||||
// License-Tag
|
|
||||||
// Authors-Tag
|
|
||||||
// ===================================================================
|
|
||||||
//
|
|
||||||
// $Id: PyBox.cpp,v 1.18 2006/09/22 11:27:30 tsunami Exp $
|
|
||||||
//
|
|
||||||
// x-----------------------------------------------------------------x
|
// x-----------------------------------------------------------------x
|
||||||
// | |
|
// | |
|
||||||
// | C O R I O L I S |
|
// | C O R I O L I S |
|
||||||
|
@ -118,7 +81,7 @@ extern "C" {
|
||||||
pyPoint->_object = new Point ( box->getCenter() );
|
pyPoint->_object = new Point ( box->getCenter() );
|
||||||
HCATCH
|
HCATCH
|
||||||
|
|
||||||
return ( (PyObject*)pyPoint );
|
return (PyObject*)pyPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,107 +91,113 @@ extern "C" {
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// Attribute Method : "PyBox_getUnion ()"
|
// Attribute Method : "PyBox_getUnion ()"
|
||||||
|
|
||||||
static PyObject* PyBox_getUnion ( PyBox *self, PyObject* args )
|
static PyObject* PyBox_getUnion ( PyBox *self, PyObject* args ) {
|
||||||
{
|
|
||||||
trace << "PyBox_getUnion()" << endl;
|
trace << "PyBox_getUnion()" << endl;
|
||||||
|
|
||||||
METHOD_HEAD ( "Box.getUnion()" )
|
METHOD_HEAD ( "Box.getUnion()" )
|
||||||
|
|
||||||
PyBox* otherPyBox;
|
PyBox* otherPyBox;
|
||||||
if ( ! ParseOneArg( "Box.getUnion", args, BOX_ARG, (PyObject**)&otherPyBox ) ) return ( NULL );
|
if (PyArg_ParseTuple(args,"O!:Box.getUnion", &PyTypeBox, &otherPyBox)) {
|
||||||
|
|
||||||
PyBox* unionPyBox = PyObject_NEW ( PyBox, &PyTypeBox );
|
PyBox* unionPyBox = PyObject_NEW ( PyBox, &PyTypeBox );
|
||||||
if (unionPyBox == NULL) { return NULL; }
|
if (unionPyBox == NULL) {
|
||||||
|
return NULL;
|
||||||
HTRY
|
|
||||||
unionPyBox->_object = new Box ( box->getUnion(*(otherPyBox->_object)) );
|
|
||||||
HCATCH
|
|
||||||
|
|
||||||
return ( (PyObject*)unionPyBox );
|
|
||||||
}
|
}
|
||||||
|
HTRY
|
||||||
|
unionPyBox->_object = new Box ( box->getUnion(*PYBOX_O(otherPyBox)));
|
||||||
|
HCATCH
|
||||||
|
return (PyObject*)unionPyBox;
|
||||||
|
} else {
|
||||||
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.getUnion.");
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// Attribute Method : "PyBox_getIntersection ()"
|
// Attribute Method : "PyBox_getIntersection ()"
|
||||||
|
|
||||||
static PyObject* PyBox_getIntersection ( PyBox *self, PyObject* args )
|
static PyObject* PyBox_getIntersection ( PyBox *self, PyObject* args ) {
|
||||||
{
|
|
||||||
trace << "PyBox_getIntersection()" << endl;
|
trace << "PyBox_getIntersection()" << endl;
|
||||||
|
|
||||||
METHOD_HEAD ( "Box.getIntersection()" )
|
METHOD_HEAD ( "Box.getIntersection()" )
|
||||||
|
|
||||||
PyBox* otherPyBox;
|
PyBox* otherPyBox;
|
||||||
if ( ! ParseOneArg ( "Box.getIntersection", args, BOX_ARG, (PyObject**)&otherPyBox ) ) return ( NULL );
|
if (PyArg_ParseTuple(args,"O!:Box.getIntersection", &PyTypeBox, &otherPyBox)) {
|
||||||
|
|
||||||
PyBox* intersectionPyBox = PyObject_NEW ( PyBox, &PyTypeBox );
|
PyBox* intersectionPyBox = PyObject_NEW ( PyBox, &PyTypeBox );
|
||||||
if (intersectionPyBox == NULL) { return NULL; }
|
if (intersectionPyBox == NULL) {
|
||||||
|
return NULL;
|
||||||
HTRY
|
}
|
||||||
intersectionPyBox->_object = new Box ( box->getIntersection(*(otherPyBox->_object)) );
|
HTRY
|
||||||
HCATCH
|
intersectionPyBox->_object = new Box(box->getIntersection(*PYBOX_O(otherPyBox)));
|
||||||
|
HCATCH
|
||||||
return ( (PyObject*)intersectionPyBox );
|
return (PyObject*)intersectionPyBox;
|
||||||
|
} else {
|
||||||
|
PyErr_SetString(ConstructorError, "invalid number of parameters for Box.getIntersection.");
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// Attribute Method : "PyBox_contains ()"
|
// Attribute Method : "PyBox_contains ()"
|
||||||
|
|
||||||
static PyObject* PyBox_contains ( PyBox *self, PyObject* args )
|
static PyObject* PyBox_contains ( PyBox *self, PyObject* args ) {
|
||||||
{
|
|
||||||
trace << "PyBox_contains ()" << endl;
|
trace << "PyBox_contains ()" << endl;
|
||||||
|
|
||||||
|
bool result = false;
|
||||||
|
HTRY
|
||||||
|
|
||||||
|
PyBox* pyBox = NULL;
|
||||||
|
PyPoint* pyPoint = NULL;
|
||||||
|
DbU::Unit x = 0, y = 0;
|
||||||
|
|
||||||
METHOD_HEAD ( "Box.contains()" )
|
METHOD_HEAD ( "Box.contains()" )
|
||||||
|
|
||||||
PyObject* arg0;
|
if (PyArg_ParseTuple(args,"O!:Box.contains", &PyTypeBox, &pyBox)) {
|
||||||
PyObject* arg1;
|
result = box->contains(*PYBOX_O(pyBox));
|
||||||
long result = 0;
|
} else if (PyArg_ParseTuple(args,"O!:Box.contains", &PyTypePoint, &pyPoint)) {
|
||||||
|
result = box->contains(*PYPOINT_O(pyPoint));
|
||||||
HTRY
|
} else if (PyArg_ParseTuple(args,"ll:Box.contains", &x, &y)) {
|
||||||
|
result = box->contains(x,y);
|
||||||
__cs.init ("Box.contains");
|
} else {
|
||||||
if ( ! PyArg_ParseTuple(args,"|O&O&:Box.contains",Converter,&arg0,Converter,&arg1) )
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.contains." );
|
||||||
return ( NULL );
|
return NULL;
|
||||||
|
|
||||||
if ( __cs.getObjectIds() == BOX_ARG ) { result = box->contains ( *PYBOX_O(arg0) ); }
|
|
||||||
else if ( __cs.getObjectIds() == POINT_ARG ) { result = box->contains ( *PYPOINT_O(arg0) ); }
|
|
||||||
else if ( __cs.getObjectIds() == INTS2_ARG ) { result = box->contains ( PyInt_AsLong(arg0)
|
|
||||||
, PyInt_AsLong(arg1) ); }
|
|
||||||
else {
|
|
||||||
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.contains constructor." );
|
|
||||||
return ( NULL );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HCATCH
|
HCATCH
|
||||||
|
if (result) {
|
||||||
return ( Py_BuildValue("i",result) );
|
Py_RETURN_TRUE;
|
||||||
|
} else {
|
||||||
|
Py_RETURN_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// Attribute Method : "PyBox_intersect ()"
|
// Attribute Method : "PyBox_intersect ()"
|
||||||
|
|
||||||
static PyObject* PyBox_intersect ( PyBox *self, PyObject* args )
|
static PyObject* PyBox_intersect ( PyBox *self, PyObject* args ) {
|
||||||
{
|
|
||||||
trace << "PyBox_intersect ()" << endl;
|
trace << "PyBox_intersect ()" << endl;
|
||||||
|
|
||||||
|
bool result = false;
|
||||||
|
HTRY
|
||||||
|
PyBox* pyBox = NULL;
|
||||||
METHOD_HEAD ( "Box.intersect()" )
|
METHOD_HEAD ( "Box.intersect()" )
|
||||||
|
|
||||||
PyBox* otherPyBox;
|
if (PyArg_ParseTuple(args,"O!:Box.intersects", &PyTypeBox, &pyBox)) {
|
||||||
|
result = box->intersect(*PYBOX_O(pyBox));
|
||||||
|
} else {
|
||||||
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.intersect." );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
HTRY
|
|
||||||
if ( ! ParseOneArg ( "Box.intersect", args, BOX_ARG, (PyObject**)&otherPyBox ) ) return ( NULL );
|
|
||||||
HCATCH
|
HCATCH
|
||||||
|
if (result) {
|
||||||
|
Py_RETURN_TRUE;
|
||||||
|
} else {
|
||||||
|
Py_RETURN_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return ( Py_BuildValue("i",(long)box->intersect(*PYBOX_O(otherPyBox))) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,19 +206,27 @@ extern "C" {
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// Attribute Method : "PyBox_isConstrainedBy ()"
|
// Attribute Method : "PyBox_isConstrainedBy ()"
|
||||||
|
|
||||||
static PyObject* PyBox_isConstrainedBy ( PyBox *self, PyObject* args )
|
static PyObject* PyBox_isConstrainedBy ( PyBox *self, PyObject* args ) {
|
||||||
{
|
|
||||||
trace << "PyBox_isConstrainedBy ()" << endl;
|
trace << "PyBox_isConstrainedBy ()" << endl;
|
||||||
|
|
||||||
|
bool result = false;
|
||||||
|
HTRY
|
||||||
|
PyBox* pyBox = NULL;
|
||||||
METHOD_HEAD("Box.isConstrainedBy()")
|
METHOD_HEAD("Box.isConstrainedBy()")
|
||||||
|
|
||||||
PyBox* otherPyBox;
|
if (PyArg_ParseTuple(args,"O!:Box.isConstrainedBy", &PyTypeBox, &pyBox)) {
|
||||||
|
result = box->isConstrainedBy(*PYBOX_O(pyBox));
|
||||||
|
} else {
|
||||||
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.isConstrainedBy.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
HTRY
|
|
||||||
if ( ! ParseOneArg ( "Box.getisConstrainedBy", args, BOX_ARG, (PyObject**)&otherPyBox ) ) return ( NULL );
|
|
||||||
HCATCH
|
HCATCH
|
||||||
|
if (result) {
|
||||||
return ( Py_BuildValue("i",(long)box->isConstrainedBy(*PYBOX_O(otherPyBox))) );
|
Py_RETURN_TRUE;
|
||||||
|
} else {
|
||||||
|
Py_RETURN_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -258,61 +235,44 @@ extern "C" {
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// Attribute Method : "PyBox_makeEmpty ()"
|
// Attribute Method : "PyBox_makeEmpty ()"
|
||||||
|
|
||||||
static PyObject* PyBox_makeEmpty ( PyBox *self, PyObject* args )
|
static PyObject* PyBox_makeEmpty ( PyBox *self, PyObject* args ) {
|
||||||
{
|
|
||||||
trace << "PyBox_makeEmpty ()" << endl;
|
trace << "PyBox_makeEmpty ()" << endl;
|
||||||
|
|
||||||
HTRY
|
HTRY
|
||||||
METHOD_HEAD ( "Box.makeEmpty()" )
|
METHOD_HEAD ( "Box.makeEmpty()" )
|
||||||
|
|
||||||
if ( ! PyArg_ParseTuple ( args,":Box" ) ) return ( NULL );
|
|
||||||
box->makeEmpty ();
|
box->makeEmpty ();
|
||||||
HCATCH
|
HCATCH
|
||||||
|
|
||||||
Py_INCREF ( self );
|
Py_INCREF ( self ); //FIXME ??
|
||||||
return ( (PyObject*)self );
|
return (PyObject*)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// Attribute Method : "PyBox_inflate ()"
|
// Attribute Method : "PyBox_inflate ()"
|
||||||
|
|
||||||
static PyObject* PyBox_inflate ( PyBox *self, PyObject* args )
|
static PyObject* PyBox_inflate(PyBox *self, PyObject* args) {
|
||||||
{
|
|
||||||
trace << "PyBox_inflate ()" << endl;
|
trace << "PyBox_inflate ()" << endl;
|
||||||
|
|
||||||
METHOD_HEAD("Box.inflate()")
|
METHOD_HEAD("Box.inflate()")
|
||||||
|
|
||||||
PyObject* arg0;
|
|
||||||
PyObject* arg1;
|
|
||||||
PyObject* arg2 = NULL;
|
|
||||||
PyObject* arg3 = NULL;
|
|
||||||
|
|
||||||
HTRY
|
HTRY
|
||||||
|
DbU::Unit arg0=0, arg1=0, arg2=0, arg3=0;
|
||||||
|
|
||||||
__cs.init ("Box.inflate");
|
if (PyArg_ParseTuple(args,"l:Box.inflate", &arg0)) {
|
||||||
if ( ! PyArg_ParseTuple(args,"|O&O&O&O&:Box.inflate",Converter,&arg0,Converter,&arg1) )
|
box->inflate(arg0);
|
||||||
return ( NULL );
|
} else if (PyArg_ParseTuple(args,"ll:Box.inflate", &arg0, &arg1)) {
|
||||||
|
box->inflate(arg0, arg1);
|
||||||
if ( __cs.getObjectIds() == INT_ARG ) { box->inflate ( PyInt_AsLong(arg0) ); }
|
} else if (PyArg_ParseTuple(args,"llll:Box.inflate", &arg0, &arg1, &arg2, &arg3)) {
|
||||||
else if ( __cs.getObjectIds() == INTS2_ARG ) { box->inflate ( PyInt_AsLong(arg0)
|
box->inflate(arg0, arg1, arg2, arg3);
|
||||||
, PyInt_AsLong(arg1) ); }
|
} else {
|
||||||
else if ( __cs.getObjectIds() == INTS4_ARG ) { box->inflate ( PyInt_AsLong(arg0)
|
|
||||||
, PyInt_AsLong(arg1)
|
|
||||||
, PyInt_AsLong(arg2)
|
|
||||||
, PyInt_AsLong(arg3) ); }
|
|
||||||
else {
|
|
||||||
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.inflate()" );
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.inflate()" );
|
||||||
return ( NULL );
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
HCATCH
|
HCATCH
|
||||||
|
|
||||||
Py_INCREF ( self );
|
Py_INCREF ( self ); //FIXME ??
|
||||||
return ( (PyObject*)self );
|
return (PyObject*)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -322,61 +282,53 @@ extern "C" {
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// Attribute Method : "PyBox_merge ()"
|
// Attribute Method : "PyBox_merge ()"
|
||||||
|
|
||||||
static PyObject* PyBox_merge ( PyBox *self, PyObject* args )
|
static PyObject* PyBox_merge ( PyBox *self, PyObject* args ) {
|
||||||
{
|
|
||||||
trace << "Box_merge()" << endl;
|
trace << "Box_merge()" << endl;
|
||||||
|
|
||||||
METHOD_HEAD ( "Box.merge()" )
|
METHOD_HEAD ( "Box.merge()" )
|
||||||
|
|
||||||
PyObject* arg0;
|
|
||||||
PyObject* arg1;
|
|
||||||
PyObject* arg2;
|
|
||||||
PyObject* arg3;
|
|
||||||
|
|
||||||
HTRY
|
HTRY
|
||||||
|
PyBox* pyBox = NULL;
|
||||||
|
PyPoint* pyPoint = NULL;
|
||||||
|
DbU::Unit arg0=0, arg1=0, arg2=0, arg3=0;
|
||||||
|
|
||||||
__cs.init ("Box.merge");
|
if (PyArg_ParseTuple(args,"O!:Box.merge", &PyTypeBox, &pyBox)) {
|
||||||
if ( ! PyArg_ParseTuple(args,"|O&O&O&O&:Box.merge",Converter,&arg0,Converter,&arg1,Converter,&arg2,Converter,&arg3) )
|
box->merge(*PYBOX_O(pyBox));
|
||||||
return ( NULL );
|
} else if (PyArg_ParseTuple(args,"O!:Box.merge", &PyTypePoint, &pyPoint)) {
|
||||||
|
box->merge(*PYPOINT_O(pyPoint));
|
||||||
if ( __cs.getObjectIds() == POINT_ARG ) { box->merge ( *PYPOINT_O(arg0) ); }
|
} else if (PyArg_ParseTuple(args,"ll:Box.merge", &arg0, &arg1)) {
|
||||||
else if ( __cs.getObjectIds() == BOX_ARG ) { box->merge ( *PYBOX_O(arg0) ); }
|
box->merge(arg0, arg1);
|
||||||
else if ( __cs.getObjectIds() == INTS2_ARG ) { box->merge ( PyInt_AsLong(arg0)
|
} else if (PyArg_ParseTuple(args,"llll:Box.merge", &arg0, &arg1, &arg2, &arg3)) {
|
||||||
, PyInt_AsLong(arg1) ); }
|
box->merge(arg0, arg1, arg2, arg3);
|
||||||
else if ( __cs.getObjectIds() == INTS4_ARG ) { box->merge ( PyInt_AsLong(arg0)
|
} else {
|
||||||
, PyInt_AsLong(arg1)
|
|
||||||
, PyInt_AsLong(arg2)
|
|
||||||
, PyInt_AsLong(arg3) ); }
|
|
||||||
else {
|
|
||||||
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.merge()" );
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.merge()" );
|
||||||
return ( NULL );
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
HCATCH
|
HCATCH
|
||||||
|
|
||||||
Py_INCREF ( self );
|
Py_INCREF ( self );
|
||||||
return ( (PyObject*)self );
|
return (PyObject*)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// Attribute Method : "PyBox_translate ()"
|
// Attribute Method : "PyBox_translate ()"
|
||||||
|
|
||||||
static PyObject* PyBox_translate ( PyBox *self, PyObject* args )
|
static PyObject* PyBox_translate ( PyBox *self, PyObject* args ) {
|
||||||
{
|
|
||||||
trace << "PyBox_translate ()" << endl;
|
trace << "PyBox_translate ()" << endl;
|
||||||
|
|
||||||
METHOD_HEAD ( "Box.translate()" )
|
|
||||||
|
|
||||||
PyObject* arg0;
|
|
||||||
PyObject* arg1;
|
|
||||||
|
|
||||||
HTRY
|
HTRY
|
||||||
if ( ! ParseTwoArg ( "Box.translate", args, INTS2_ARG, &arg0, &arg1 ) ) return ( NULL );
|
METHOD_HEAD ( "Box.translate()" )
|
||||||
box->translate ( PyInt_AsLong(arg0), PyInt_AsLong(arg1) );
|
DbU::Unit dx=0, dy=0;
|
||||||
|
if (PyArg_ParseTuple(args,"ll:Box.translate", &dx, &dy)) {
|
||||||
|
box->translate(dx, dy);
|
||||||
|
} else {
|
||||||
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.translate()" );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
HCATCH
|
HCATCH
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,51 +373,35 @@ extern "C" {
|
||||||
PyObject* PyBox_new (PyTypeObject *type, PyObject *args, PyObject *kwds) {
|
PyObject* PyBox_new (PyTypeObject *type, PyObject *args, PyObject *kwds) {
|
||||||
trace << "PyBox_new()" << endl;
|
trace << "PyBox_new()" << endl;
|
||||||
|
|
||||||
Box* box;
|
PyBox* pyBox=NULL;
|
||||||
PyObject* arg0;
|
HTRY
|
||||||
PyObject* arg1;
|
Box* box = NULL;
|
||||||
PyObject* arg2;
|
PyPoint *pyPoint1=NULL, *pyPoint2=NULL;
|
||||||
PyObject* arg3;
|
DbU::Unit arg0=0, arg1=0, arg2=0, arg3=0;
|
||||||
|
|
||||||
__cs.init ("Box.new");
|
if (PyArg_ParseTuple(args, ":Box.new")) {
|
||||||
if ( ! PyArg_ParseTuple(args,"|O&O&O&O&:Box.new"
|
box = new Box;
|
||||||
,Converter,&arg0
|
} else if (PyArg_ParseTuple(args, "O!:Box.new", &PyTypePoint, &pyPoint1)) {
|
||||||
,Converter,&arg1
|
box = new Box(*PYPOINT_O(pyPoint1));
|
||||||
,Converter,&arg2
|
} else if (PyArg_ParseTuple(args, "O!:Box.new", &PyTypeBox, &pyBox)) {
|
||||||
,Converter,&arg3
|
box = new Box(*PYBOX_O(pyBox));
|
||||||
) ) return ( NULL );
|
} else if (PyArg_ParseTuple(args, "O!O!:Box.new", &PyTypePoint, &pyPoint1, &PyTypePoint, &pyPoint2)) {
|
||||||
|
box = new Box(*PYPOINT_O(pyPoint1), *PYPOINT_O(pyPoint2));
|
||||||
if ( __cs.getObjectIds() == NO_ARG ) { box = new Box (); }
|
} else if (PyArg_ParseTuple(args, "ll:Box.new", &arg0, &arg1)) {
|
||||||
else if ( __cs.getObjectIds() == POINT_ARG ) { box = new Box ( *PYPOINT_O(arg0) ); }
|
box = new Box(arg0, arg1);
|
||||||
else if ( __cs.getObjectIds() == BOX_ARG ) { box = new Box ( *PYBOX_O(arg0) ); }
|
} else if (PyArg_ParseTuple(args, "llll:Box.new", &arg0, &arg1, &arg2, &arg3)) {
|
||||||
else if ( __cs.getObjectIds() == POINTS2_ARG ) { box = new Box ( *PYPOINT_O(arg0)
|
box = new Box(arg0, arg1, arg2, arg3);
|
||||||
, *PYPOINT_O(arg1) ); }
|
} else {
|
||||||
else if ( __cs.getObjectIds() == INTS2_ARG ) { box = new Box ( PyInt_AsLong(arg0)
|
|
||||||
, PyInt_AsLong(arg1) ); }
|
|
||||||
else if ( __cs.getObjectIds() == INTS4_ARG ) { box = new Box ( PyInt_AsLong(arg0)
|
|
||||||
, PyInt_AsLong(arg1)
|
|
||||||
, PyInt_AsLong(arg2)
|
|
||||||
, PyInt_AsLong(arg3) ); }
|
|
||||||
else {
|
|
||||||
PyErr_SetString(ConstructorError, "invalid number of parameters for Box constructor." );
|
PyErr_SetString(ConstructorError, "invalid number of parameters for Box constructor." );
|
||||||
return ( NULL );
|
return ( NULL );
|
||||||
}
|
}
|
||||||
|
pyBox = PyObject_NEW(PyBox, &PyTypeBox);
|
||||||
PyBox* pyBox = PyObject_NEW(PyBox, &PyTypeBox);
|
|
||||||
if (pyBox == NULL) return NULL;
|
if (pyBox == NULL) return NULL;
|
||||||
|
|
||||||
trace_in ();
|
|
||||||
trace << "new PyBox [" << hex << pyBox << "]" << endl;
|
|
||||||
trace_out ();
|
|
||||||
|
|
||||||
HTRY
|
|
||||||
|
|
||||||
pyBox->_object = box;
|
pyBox->_object = box;
|
||||||
//box->SetProxy ( (void**)&(pyBox->_object) );
|
|
||||||
|
|
||||||
HCATCH
|
HCATCH
|
||||||
|
|
||||||
return ( (PyObject*)pyBox );
|
return (PyObject*)pyBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,40 +1,3 @@
|
||||||
|
|
||||||
// -*- C++ -*-
|
|
||||||
//
|
|
||||||
// This file is part of the Coriolis Project.
|
|
||||||
// Copyright (C) Laboratoire LIP6 - Departement ASIM
|
|
||||||
// Universite Pierre et Marie Curie
|
|
||||||
//
|
|
||||||
// Main contributors :
|
|
||||||
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
|
|
||||||
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
|
|
||||||
// Hugo Clément <Hugo.Clement@lip6.fr>
|
|
||||||
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
|
|
||||||
// Damien Dupuis <Damien.Dupuis@lip6.fr>
|
|
||||||
// Christian Masson <Christian.Masson@lip6.fr>
|
|
||||||
// Marek Sroka <Marek.Sroka@lip6.fr>
|
|
||||||
//
|
|
||||||
// The Coriolis Project is free software; you can redistribute it
|
|
||||||
// and/or modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2 of
|
|
||||||
// the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// The Coriolis Project 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 General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with the Coriolis Project; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
// USA
|
|
||||||
//
|
|
||||||
// License-Tag
|
|
||||||
// Authors-Tag
|
|
||||||
// ===================================================================
|
|
||||||
//
|
|
||||||
// $Id: PyContact.cpp,v 1.21 2008/02/07 17:09:41 xtof Exp $
|
|
||||||
//
|
|
||||||
// x-----------------------------------------------------------------x
|
// x-----------------------------------------------------------------x
|
||||||
// | |
|
// | |
|
||||||
// | C O R I O L I S |
|
// | C O R I O L I S |
|
||||||
|
@ -129,79 +92,27 @@ extern "C" {
|
||||||
static PyObject* PyContact_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
|
static PyObject* PyContact_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
|
||||||
trace << "PyContact_new()" << endl;
|
trace << "PyContact_new()" << endl;
|
||||||
|
|
||||||
PyObject* arg0;
|
|
||||||
PyObject* arg1;
|
|
||||||
PyObject* arg2;
|
|
||||||
PyObject* arg3;
|
|
||||||
PyObject* arg4;
|
|
||||||
PyObject* arg5;
|
|
||||||
Contact* contact = NULL;
|
Contact* contact = NULL;
|
||||||
|
|
||||||
HTRY
|
HTRY
|
||||||
|
PyNet* pyNet = NULL;
|
||||||
__cs.init ("Contact.new");
|
PyLayer* pyLayer = NULL;
|
||||||
if ( ! PyArg_ParseTuple(args,"O&O&O&O&|O&O&:Contact.new"
|
PyComponent* pyComponent = NULL;
|
||||||
,Converter,&arg0
|
DbU::Unit x=0, y=0, width=0, height=0;
|
||||||
,Converter,&arg1
|
if (PyArg_ParseTuple(args, "O!O!ll|ll:Contact.new",
|
||||||
,Converter,&arg2
|
&PyTypeNet, &pyNet, &PyTypeLayer, &pyLayer,
|
||||||
,Converter,&arg3
|
&x, &y, &width, &height)) {
|
||||||
,Converter,&arg4
|
contact = Contact::create(PYNET_O(pyNet), PYLAYER_O(pyLayer), x, y, width, height);
|
||||||
,Converter,&arg5
|
} else if (PyArg_ParseTuple(args, "O!O!ll|ll:Contact.new",
|
||||||
)) {
|
&PyTypeComponent, &pyComponent, &PyTypeLayer, &pyLayer,
|
||||||
|
&x, &y, &width, &height)) {
|
||||||
|
contact = Contact::create(PYCOMPONENT_O(pyComponent), PYLAYER_O(pyLayer), x, y, width, height);
|
||||||
|
} else {
|
||||||
PyErr_SetString ( ConstructorError, "invalid number of parameters for Contact constructor." );
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Contact constructor." );
|
||||||
return ( NULL );
|
return ( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//cerr << "Format := " << __cs.getObjectIds() << endl;
|
|
||||||
if ( __cs.getObjectIds() == NET_LAYER_INTS2_ARG )
|
|
||||||
contact = Contact::create ( PYNET_O(arg0)
|
|
||||||
, PYLAYER_O(arg1)
|
|
||||||
, PyInt_AsLong(arg2)
|
|
||||||
, PyInt_AsLong(arg3) );
|
|
||||||
|
|
||||||
else if ( __cs.getObjectIds() == NET_LAYER_INTS3_ARG )
|
|
||||||
contact = Contact::create ( PYNET_O(arg0)
|
|
||||||
, PYLAYER_O(arg1)
|
|
||||||
, PyInt_AsLong(arg2)
|
|
||||||
, PyInt_AsLong(arg3)
|
|
||||||
, PyInt_AsLong(arg4) );
|
|
||||||
|
|
||||||
else if ( __cs.getObjectIds() == NET_LAYER_INTS4_ARG )
|
|
||||||
contact = Contact::create ( PYNET_O(arg0)
|
|
||||||
, PYLAYER_O(arg1)
|
|
||||||
, PyInt_AsLong(arg2)
|
|
||||||
, PyInt_AsLong(arg3)
|
|
||||||
, PyInt_AsLong(arg4)
|
|
||||||
, PyInt_AsLong(arg5) );
|
|
||||||
|
|
||||||
else if ( __cs.getObjectIds() == COMP_LAYER_INTS2_ARG )
|
|
||||||
contact = Contact::create ( PYCOMPONENT_O(arg0)
|
|
||||||
, PYLAYER_O(arg1)
|
|
||||||
, PyInt_AsLong(arg2)
|
|
||||||
, PyInt_AsLong(arg3) );
|
|
||||||
|
|
||||||
else if ( __cs.getObjectIds() == COMP_LAYER_INTS3_ARG )
|
|
||||||
contact = Contact::create ( PYCOMPONENT_O(arg0)
|
|
||||||
, PYLAYER_O(arg1)
|
|
||||||
, PyInt_AsLong(arg2)
|
|
||||||
, PyInt_AsLong(arg3)
|
|
||||||
, PyInt_AsLong(arg4) );
|
|
||||||
|
|
||||||
else if ( __cs.getObjectIds() == COMP_LAYER_INTS4_ARG )
|
|
||||||
contact = Contact::create ( PYCOMPONENT_O(arg0)
|
|
||||||
, PYLAYER_O(arg1)
|
|
||||||
, PyInt_AsLong(arg2)
|
|
||||||
, PyInt_AsLong(arg3)
|
|
||||||
, PyInt_AsLong(arg4)
|
|
||||||
, PyInt_AsLong(arg5) );
|
|
||||||
else {
|
|
||||||
PyErr_SetString ( ConstructorError, "invalid number of parameters for Contact constructor." );
|
|
||||||
return ( NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (contact == NULL) { printf("error of creation of contact \n") ; return (NULL) ; }
|
|
||||||
|
|
||||||
HCATCH
|
HCATCH
|
||||||
|
|
||||||
return PyContact_Link(contact);
|
return PyContact_Link(contact);
|
||||||
|
|
|
@ -1,40 +1,3 @@
|
||||||
|
|
||||||
// -*- C++ -*-
|
|
||||||
//
|
|
||||||
// This file is part of the Coriolis Project.
|
|
||||||
// Copyright (C) Laboratoire LIP6 - Departement ASIM
|
|
||||||
// Universite Pierre et Marie Curie
|
|
||||||
//
|
|
||||||
// Main contributors :
|
|
||||||
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
|
|
||||||
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
|
|
||||||
// Hugo Clément <Hugo.Clement@lip6.fr>
|
|
||||||
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
|
|
||||||
// Damien Dupuis <Damien.Dupuis@lip6.fr>
|
|
||||||
// Christian Masson <Christian.Masson@lip6.fr>
|
|
||||||
// Marek Sroka <Marek.Sroka@lip6.fr>
|
|
||||||
//
|
|
||||||
// The Coriolis Project is free software; you can redistribute it
|
|
||||||
// and/or modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2 of
|
|
||||||
// the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// The Coriolis Project 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 General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with the Coriolis Project; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
// USA
|
|
||||||
//
|
|
||||||
// License-Tag
|
|
||||||
// Authors-Tag
|
|
||||||
// ===================================================================
|
|
||||||
//
|
|
||||||
// $Id: PyNet.h,v 1.7 2006/05/03 14:00:03 jpc Exp $
|
|
||||||
//
|
|
||||||
// x-----------------------------------------------------------------x
|
// x-----------------------------------------------------------------x
|
||||||
// | |
|
// | |
|
||||||
// | C O R I O L I S |
|
// | C O R I O L I S |
|
||||||
|
|
Loading…
Reference in New Issue