translate methods
    UpdateSession methods
    for python layout
This commit is contained in:
Damien Dupuis 2009-11-26 12:18:12 +00:00
parent 31ae717b32
commit dda0af6966
5 changed files with 73 additions and 2 deletions

View File

@ -64,6 +64,27 @@ extern "C" {
DBoDestroyAttribute(PyContact_destroy, PyContact)
// ---------------------------------------------------------------
// Attribute Method : "PyContact_translate ()"
static PyObject* PyContact_translate ( PyContact *self, PyObject* args ) {
trace << "PyContact_translate ()" << endl;
HTRY
METHOD_HEAD ( "Contact.translate()" )
DbU::Unit dx=0, dy=0;
if (PyArg_ParseTuple(args,"ll:Contact.translate", &dx, &dy)) {
contact->translate(dx, dy);
} else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Contact.translate()" );
return NULL;
}
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// PyContact Attribute Method table.
@ -76,6 +97,7 @@ extern "C" {
, { "getHalfHeight" , (PyCFunction)PyContact_getHalfHeight , METH_NOARGS , "Return the contact half height." }
, { "getDx" , (PyCFunction)PyContact_getDx , METH_NOARGS , "Return the contact dx value." }
, { "getDy" , (PyCFunction)PyContact_getDy , METH_NOARGS , "Return the contact dy value." }
, { "translate" , (PyCFunction)PyContact_translate , METH_VARARGS, "Translates the Contact of dx and dy." }
, {NULL, NULL, 0, NULL} /* sentinel */
};

View File

@ -166,7 +166,8 @@ extern "C" {
if ( ! PyArg_ParseTuple(args,"|O&:DbU.grid",Converter,&arg0) )
return ( NULL );
if ( __cs.getObjectIds() == FLOAT_ARG ) { result = DbU::grid ( PyFloat_AsDouble ( arg0 ) ); }
if ( __cs.getObjectIds() == FLOAT_ARG ) { result = DbU::grid ( PyFloat_AsDouble ( arg0 ) ); }
else if ( __cs.getObjectIds() == INT_ARG ) { result = DbU::grid ( PyInt_AsLong ( arg0 ) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters or bad type for DbU.grid converter." );
return ( NULL );

View File

@ -511,6 +511,8 @@ extern "C" {
, { "Point" , PyPoint_create , METH_VARARGS, "Creates a new Point." }
, { "Box" , PyBox_create , METH_VARARGS, "Creates a new Box." }
, { "Transformation" , PyTransformation_create , METH_VARARGS, "Creates a new Transformation." }
, { "UpdateSession_open" , (PyCFunction)PyUpdateSession_open , METH_NOARGS , "Opens an update session." }
, { "UpdateSession_close" , (PyCFunction)PyUpdateSession_close , METH_NOARGS , "Closes an update session." }
, { "DataBase" , (PyCFunction)PyDataBase_create , METH_NOARGS , "Creates the DataBase." }
, { "getDataBase" , (PyCFunction)PyDataBase_getDataBase , METH_NOARGS , "Gets the current DataBase." }
, { "Library" , (PyCFunction)PyLibrary_create , METH_VARARGS, "Creates a new Library." }
@ -669,6 +671,7 @@ extern "C" {
<< " Failed to initialize Hurricane module." << endl;
return;
}
//PyModule_AddObject(module, "Box", (PyObject*)&PyTypeBox); // To add Hurricane.Box type in module -> the Hurricane.Box() method must be renamed
PyObject* dictionnary = PyModule_GetDict ( module );

View File

@ -74,6 +74,28 @@ extern "C" {
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// Attribute Method : "PyPad_translate ()"
static PyObject* PyPad_translate ( PyPad *self, PyObject* args ) {
trace << "PyPad_translate ()" << endl;
HTRY
METHOD_HEAD ( "Pad.translate()" )
DbU::Unit dx=0, dy=0;
if (PyArg_ParseTuple(args,"ll:Pad.translate", &dx, &dy)) {
pad->translate(dx, dy);
} else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Pad.translate()" );
return NULL;
}
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// PyPad Attribute Method table.
@ -82,6 +104,7 @@ extern "C" {
, { "getY" , (PyCFunction)PyPad_getY , METH_NOARGS, "Return the Pad Y value." }
, { "getBoundingBox" , (PyCFunction)PyPad_getBoundingBox, METH_NOARGS, "Return the Pad Bounding Box." }
, { "setBoundingBox" , (PyCFunction)PyPad_setBoundingBox, METH_VARARGS, "Sets the Pad Bounding Box." }
, { "translate" , (PyCFunction)PyPad_translate , METH_VARARGS, "Translates the Pad of dx and dy." }
, { "destroy" , (PyCFunction)PyPad_destroy , METH_NOARGS
, "Destroy associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */

View File

@ -49,12 +49,34 @@ extern "C" {
DBoDestroyAttribute(PyVertical_destroy, PyVertical)
// ---------------------------------------------------------------
// Attribute Method : "PyVertical_translate ()"
static PyObject* PyVertical_translate ( PyVertical *self, PyObject* args ) {
trace << "PyVertical_translate ()" << endl;
HTRY
METHOD_HEAD ( "Vertical.translate()" )
DbU::Unit dx=0, dy=0;
if (PyArg_ParseTuple(args,"ll:Vertical.translate", &dx, &dy)) {
vertical->translate(dx, dy);
} else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Vertical.translate()" );
return NULL;
}
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// PyVertical Attribute Method table.
PyMethodDef PyVertical_Methods[] =
{ { "destroy" , (PyCFunction)PyVertical_destroy , METH_NOARGS
{ { "destroy" , (PyCFunction)PyVertical_destroy , METH_NOARGS
, "Destroy associated hurricane object, the python object remains." }
, { "translate" , (PyCFunction)PyVertical_translate , METH_VARARGS, "Translates the Vertical segment of dx and dy." }
, {NULL, NULL, 0, NULL} /* sentinel */
};