soc-2008-mxcurioni: made considerable changes to support cross-language polymorphism for UnaryFunction0D, Interface0D, Interface1D. Add to change UnaryFunction1D<void> to static UnaryFunction1D_void. Resolved namespace collision on the Image class (changed to FrsImage). There is greater support for style modules but somehow, some do not show anything yet (japanese_bigbrush being an example).
This commit is contained in:
@@ -44,12 +44,12 @@
|
||||
* size w*h, and access these pixels using x,y coordinates
|
||||
* specified in the whole image coordinate system.
|
||||
*/
|
||||
class Image
|
||||
class FrsImage
|
||||
{
|
||||
public:
|
||||
|
||||
/*! Default constructor */
|
||||
Image() {
|
||||
FrsImage() {
|
||||
_storedWidth = 0;
|
||||
_storedHeight = 0;
|
||||
_width = 0;
|
||||
@@ -59,7 +59,7 @@ class Image
|
||||
}
|
||||
|
||||
/*! Copy constructor */
|
||||
Image(const Image& brother) {
|
||||
FrsImage(const FrsImage& brother) {
|
||||
_storedWidth = brother._storedWidth;
|
||||
_storedHeight = brother._storedHeight;
|
||||
_width = brother._width;
|
||||
@@ -68,10 +68,10 @@ class Image
|
||||
_Oy = brother._Oy;
|
||||
}
|
||||
|
||||
/*! Builds an image from its width and height.
|
||||
/*! Builds an FrsImage from its width and height.
|
||||
* The memory is allocated consequently.
|
||||
*/
|
||||
Image(unsigned w, unsigned h) {
|
||||
FrsImage(unsigned w, unsigned h) {
|
||||
_width = w;
|
||||
_height = h;
|
||||
_storedWidth = w;
|
||||
@@ -98,7 +98,7 @@ class Image
|
||||
* The x-abscissa of the origin of the rectangle that will actually
|
||||
* be stored.
|
||||
*/
|
||||
Image(unsigned w, unsigned h, unsigned sw, unsigned sh, unsigned ox, unsigned oy) {
|
||||
FrsImage(unsigned w, unsigned h, unsigned sw, unsigned sh, unsigned ox, unsigned oy) {
|
||||
_width = w;
|
||||
_height = h;
|
||||
_storedWidth = sw;
|
||||
@@ -108,7 +108,7 @@ class Image
|
||||
}
|
||||
|
||||
/*! Operator= */
|
||||
Image& operator=(const Image& brother) {
|
||||
FrsImage& operator=(const FrsImage& brother) {
|
||||
_width = brother._width;
|
||||
_height = brother._height;
|
||||
_storedWidth = brother._storedWidth;
|
||||
@@ -119,7 +119,7 @@ class Image
|
||||
}
|
||||
|
||||
/*! Destructor */
|
||||
virtual ~Image() {}
|
||||
virtual ~FrsImage() {}
|
||||
|
||||
/*! Returns the width of the complete image */
|
||||
inline unsigned width() const {
|
||||
@@ -181,24 +181,24 @@ class Image
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class RGBImage : public Image
|
||||
class RGBImage : public FrsImage
|
||||
{
|
||||
public:
|
||||
|
||||
RGBImage() : Image() {
|
||||
RGBImage() : FrsImage() {
|
||||
_rgb = 0;
|
||||
}
|
||||
|
||||
RGBImage(const RGBImage& brother) : Image(brother) {
|
||||
RGBImage(const RGBImage& brother) : FrsImage(brother) {
|
||||
_rgb = new float[3 * _storedWidth * _storedHeight];
|
||||
memcpy(_rgb, brother._rgb, 3 * _storedWidth * _storedHeight * sizeof(float));
|
||||
}
|
||||
|
||||
RGBImage(unsigned w, unsigned h) : Image(w, h) {
|
||||
RGBImage(unsigned w, unsigned h) : FrsImage(w, h) {
|
||||
_rgb = new float[3 * _width * _height];
|
||||
}
|
||||
|
||||
RGBImage(float* rgb, unsigned w, unsigned h) : Image(w, h) {
|
||||
RGBImage(float* rgb, unsigned w, unsigned h) : FrsImage(w, h) {
|
||||
_rgb = new float[3 * _width * _height];
|
||||
memcpy(_rgb, rgb, 3 * _width * _height * sizeof(float));
|
||||
}
|
||||
@@ -218,13 +218,13 @@ class RGBImage : public Image
|
||||
* \param sh
|
||||
* The height of the part of the image we want to store and work on
|
||||
*/
|
||||
RGBImage(float* rgb, unsigned w, unsigned h, unsigned sw, unsigned sh, unsigned ox, unsigned oy) : Image(w, h, sw, sh, ox, oy) {
|
||||
RGBImage(float* rgb, unsigned w, unsigned h, unsigned sw, unsigned sh, unsigned ox, unsigned oy) : FrsImage(w, h, sw, sh, ox, oy) {
|
||||
_rgb = new float[3 * _storedWidth * _storedHeight];
|
||||
memcpy(_rgb, rgb, 3 * _storedWidth * _storedHeight * sizeof(float));
|
||||
}
|
||||
|
||||
RGBImage& operator=(const RGBImage& brother) {
|
||||
dynamic_cast<Image&>(*this) = brother;
|
||||
dynamic_cast<FrsImage&>(*this) = brother;
|
||||
_rgb = new float[3 * _storedWidth * _storedHeight];
|
||||
memcpy(_rgb, brother._rgb, 3 * _storedWidth * _storedHeight * sizeof(float));
|
||||
return* this;
|
||||
@@ -296,25 +296,25 @@ class RGBImage : public Image
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class GrayImage : public Image
|
||||
class GrayImage : public FrsImage
|
||||
{
|
||||
public:
|
||||
|
||||
GrayImage() : Image() {
|
||||
GrayImage() : FrsImage() {
|
||||
_lvl = 0;
|
||||
}
|
||||
|
||||
GrayImage(const GrayImage& brother) : Image(brother) {
|
||||
GrayImage(const GrayImage& brother) : FrsImage(brother) {
|
||||
_lvl = new float[_storedWidth*_storedHeight];
|
||||
memcpy(_lvl, brother._lvl, _storedWidth*_storedHeight*sizeof(*_lvl));
|
||||
}
|
||||
|
||||
/*! Builds an empty gray image */
|
||||
GrayImage(unsigned w, unsigned h) : Image(w, h) {
|
||||
GrayImage(unsigned w, unsigned h) : FrsImage(w, h) {
|
||||
_lvl = new float[_width*_height];
|
||||
}
|
||||
|
||||
GrayImage(float* lvl, unsigned w, unsigned h) : Image(w, h) {
|
||||
GrayImage(float* lvl, unsigned w, unsigned h) : FrsImage(w, h) {
|
||||
_lvl = new float[_width*_height];
|
||||
memcpy(_lvl, lvl, _width*_height*sizeof(*_lvl));
|
||||
}
|
||||
@@ -334,13 +334,13 @@ class GrayImage : public Image
|
||||
* \param sh
|
||||
* The height of the part of the image we want to store and work on
|
||||
*/
|
||||
GrayImage(float* lvl, unsigned w, unsigned h, unsigned sw, unsigned sh, unsigned ox, unsigned oy) : Image(w, h, sw, sh, ox, oy) {
|
||||
GrayImage(float* lvl, unsigned w, unsigned h, unsigned sw, unsigned sh, unsigned ox, unsigned oy) : FrsImage(w, h, sw, sh, ox, oy) {
|
||||
_lvl = new float[_storedWidth*_storedHeight];
|
||||
memcpy(_lvl, lvl, _storedWidth*_storedHeight*sizeof(float));
|
||||
}
|
||||
|
||||
GrayImage& operator=(const GrayImage& brother) {
|
||||
dynamic_cast<Image&>(*this) = brother;
|
||||
dynamic_cast<FrsImage&>(*this) = brother;
|
||||
_lvl = new float[_storedWidth * _storedHeight];
|
||||
memcpy(_lvl, brother._lvl, _storedWidth * _storedHeight * sizeof(float));
|
||||
return *this;
|
||||
|
||||
@@ -39,14 +39,15 @@ extern "C" {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//==============================
|
||||
// C++ => Python
|
||||
//==============================
|
||||
|
||||
|
||||
PyObject * PyBool_from_bool( bool b ){
|
||||
return PyBool_FromLong( b ? 1 : 0);
|
||||
}
|
||||
|
||||
bool bool_from_PyBool( PyObject *b ) {
|
||||
return b == Py_True;
|
||||
}
|
||||
|
||||
PyObject * Vector_from_Vec2f( Vec2f& vec ) {
|
||||
float vec_data[2]; // because vec->_coord is protected
|
||||
@@ -224,19 +225,6 @@ PyObject * BPy_directedViewEdge_from_directedViewEdge( ViewVertex::directedViewE
|
||||
return py_dve;
|
||||
}
|
||||
|
||||
|
||||
//==============================
|
||||
// Constants
|
||||
//==============================
|
||||
|
||||
IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj ) {
|
||||
return static_cast<IntegrationType>( PyInt_AsLong(obj) );
|
||||
}
|
||||
|
||||
Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj ) {
|
||||
return static_cast<Stroke::MediumType>( PyInt_AsLong(obj) );
|
||||
}
|
||||
|
||||
//==============================
|
||||
// Iterators
|
||||
//==============================
|
||||
@@ -323,7 +311,48 @@ PyObject * BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator( ChainSilhou
|
||||
}
|
||||
|
||||
|
||||
//==============================
|
||||
// Python => C++
|
||||
//==============================
|
||||
|
||||
bool bool_from_PyBool( PyObject *b ) {
|
||||
return b == Py_True;
|
||||
}
|
||||
|
||||
IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj ) {
|
||||
return static_cast<IntegrationType>( PyInt_AsLong(obj) );
|
||||
}
|
||||
|
||||
Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj ) {
|
||||
return static_cast<Stroke::MediumType>( PyInt_AsLong(obj) );
|
||||
}
|
||||
|
||||
Nature::EdgeNature EdgeNature_from_BPy_Nature( PyObject* obj ) {
|
||||
return static_cast<Nature::EdgeNature>( PyInt_AsLong(obj) );
|
||||
}
|
||||
|
||||
Vec2f * Vec2f_ptr_from_Vector( PyObject* obj ) {
|
||||
float x = PyFloat_AsDouble( PyObject_GetAttrString(obj,"x") );
|
||||
float y = PyFloat_AsDouble( PyObject_GetAttrString(obj,"y") );
|
||||
|
||||
return new Vec2f(x,y);
|
||||
}
|
||||
|
||||
Vec3f * Vec3f_ptr_from_Vector( PyObject* obj ) {
|
||||
float x = PyFloat_AsDouble( PyObject_GetAttrString(obj,"x") );
|
||||
float y = PyFloat_AsDouble( PyObject_GetAttrString(obj,"y") );
|
||||
float z = PyFloat_AsDouble( PyObject_GetAttrString(obj,"z") );
|
||||
|
||||
return new Vec3f(x,y,z);
|
||||
}
|
||||
|
||||
Vec3r * Vec3r_ptr_from_Vector( PyObject* obj ) {
|
||||
double x = PyFloat_AsDouble( PyObject_GetAttrString(obj,"x") );
|
||||
double y = PyFloat_AsDouble( PyObject_GetAttrString(obj,"y") );
|
||||
double z = PyFloat_AsDouble( PyObject_GetAttrString(obj,"z") );
|
||||
|
||||
return new Vec3r(x,y,z);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -23,6 +23,9 @@ using namespace Geometry;
|
||||
// Material
|
||||
#include "../scene_graph/Material.h"
|
||||
|
||||
// Nature::VertexNature, Nature::EdgeNature
|
||||
#include "../winged_edge/Nature.h"
|
||||
|
||||
// Stroke, StrokeAttribute, StrokeVertex
|
||||
#include "../stroke/Stroke.h"
|
||||
|
||||
@@ -58,16 +61,15 @@ extern "C" {
|
||||
#include "api2_2x/vector.h"
|
||||
#include "api2_2x/gen_utils.h"
|
||||
|
||||
PyObject * PyBool_from_bool( bool b );
|
||||
bool bool_from_PyBool( PyObject *b );
|
||||
//==============================
|
||||
// C++ => Python
|
||||
//==============================
|
||||
|
||||
PyObject * PyBool_from_bool( bool b );
|
||||
PyObject * Vector_from_Vec2f( Vec2f& v );
|
||||
PyObject * Vector_from_Vec3f( Vec3f& v );
|
||||
PyObject * Vector_from_Vec3r( Vec3r& v );
|
||||
|
||||
IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj );
|
||||
Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj );
|
||||
|
||||
PyObject * BPy_BBox_from_BBox( BBox< Vec3r > &bb );
|
||||
PyObject * BPy_CurvePoint_from_CurvePoint( CurvePoint& cp );
|
||||
PyObject * BPy_directedViewEdge_from_directedViewEdge( ViewVertex::directedViewEdge& dve );
|
||||
@@ -99,8 +101,19 @@ PyObject * BPy_ChainingIterator_from_ChainingIterator( ChainingIterator& c_it );
|
||||
PyObject * BPy_ChainPredicateIterator_from_ChainPredicateIterator( ChainPredicateIterator& cp_it );
|
||||
PyObject * BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator( ChainSilhouetteIterator& cs_it );
|
||||
|
||||
//==============================
|
||||
// Python => C++
|
||||
//==============================
|
||||
|
||||
bool bool_from_PyBool( PyObject *b );
|
||||
IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj );
|
||||
Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj );
|
||||
Nature::EdgeNature EdgeNature_from_BPy_Nature( PyObject* obj );
|
||||
Vec2f * Vec2f_ptr_from_Vector( PyObject* obj );
|
||||
Vec3f * Vec3f_ptr_from_Vector( PyObject* obj );
|
||||
Vec3r * Vec3r_ptr_from_Vector( PyObject* obj );
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -30,6 +30,10 @@ static PyObject *Interface1D_getId( BPy_Interface1D *self );
|
||||
static PyObject *Interface1D_getNature( BPy_Interface1D *self );
|
||||
static PyObject *Interface1D_getTimeStamp( BPy_Interface1D *self );
|
||||
static PyObject *Interface1D_setTimeStamp( BPy_Interface1D *self, PyObject *args);
|
||||
static PyObject * Interface1D_verticesBegin( BPy_Interface1D *self );
|
||||
static PyObject * Interface1D_verticesEnd( BPy_Interface1D *self );
|
||||
static PyObject * Interface1D_pointsBegin( BPy_Interface1D *self, PyObject *args );
|
||||
static PyObject * Interface1D_pointsEnd( BPy_Interface1D *self, PyObject *args );
|
||||
|
||||
/*----------------------Interface1D instance definitions ----------------------------*/
|
||||
static PyMethodDef BPy_Interface1D_methods[] = {
|
||||
@@ -41,6 +45,11 @@ static PyMethodDef BPy_Interface1D_methods[] = {
|
||||
{"getNature", ( PyCFunction ) Interface1D_getNature, METH_NOARGS, "Returns the nature of the 1D element"},
|
||||
{"getTimeStamp", ( PyCFunction ) Interface1D_getTimeStamp, METH_NOARGS, "Returns the time stamp of the 1D element. Mainly used for selection"},
|
||||
{"setTimeStamp", ( PyCFunction ) Interface1D_setTimeStamp, METH_VARARGS, "Sets the time stamp for the 1D element"},
|
||||
{"verticesBegin", ( PyCFunction ) Interface1D_verticesBegin, METH_NOARGS, ""},
|
||||
{"verticesEnd", ( PyCFunction ) Interface1D_verticesEnd, METH_NOARGS, ""},
|
||||
{"pointsBegin", ( PyCFunction ) Interface1D_pointsBegin, METH_VARARGS, ""},
|
||||
{"pointsEnd", ( PyCFunction ) Interface1D_pointsEnd, METH_VARARGS, ""},
|
||||
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -189,6 +198,7 @@ PyMODINIT_FUNC Interface1D_Init( PyObject *module )
|
||||
int Interface1D___init__(BPy_Interface1D *self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
self->if1D = new Interface1D();
|
||||
self->if1D->py_if1D = (PyObject *) self;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -245,6 +255,41 @@ PyObject *Interface1D_setTimeStamp( BPy_Interface1D *self, PyObject *args) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject * Interface1D_verticesBegin( BPy_Interface1D *self ) {
|
||||
Interface0DIterator if0D_it( self->if1D->verticesBegin() );
|
||||
return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it );
|
||||
}
|
||||
|
||||
PyObject * Interface1D_verticesEnd( BPy_Interface1D *self ) {
|
||||
Interface0DIterator if0D_it( self->if1D->verticesEnd() );
|
||||
return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it );
|
||||
}
|
||||
|
||||
|
||||
PyObject * Interface1D_pointsBegin( BPy_Interface1D *self, PyObject *args ) {
|
||||
float f = 0;
|
||||
|
||||
if(!( PyArg_ParseTuple(args, "|f", &f) )) {
|
||||
cout << "ERROR: Interface1D_pointsBegin" << endl;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
Interface0DIterator if0D_it( self->if1D->pointsBegin(f) );
|
||||
return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it );
|
||||
}
|
||||
|
||||
PyObject * Interface1D_pointsEnd( BPy_Interface1D *self, PyObject *args ) {
|
||||
float f = 0;
|
||||
|
||||
if(!( PyArg_ParseTuple(args, "|f", &f) )) {
|
||||
cout << "ERROR: Interface1D_pointsEnd" << endl;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
Interface0DIterator if0D_it( self->if1D->pointsEnd(f) );
|
||||
return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -4,14 +4,29 @@
|
||||
|
||||
#include "BPy_BinaryPredicate0D.h"
|
||||
#include "BPy_BinaryPredicate1D.h"
|
||||
#include "BPy_FrsMaterial.h"
|
||||
#include "BPy_Id.h"
|
||||
#include "BPy_UnaryFunction0D.h"
|
||||
#include "BPy_UnaryFunction1D.h"
|
||||
#include "BPy_UnaryPredicate0D.h"
|
||||
#include "BPy_UnaryPredicate1D.h"
|
||||
#include "BPy_StrokeShader.h"
|
||||
#include "Iterator/BPy_ChainingIterator.h"
|
||||
#include "Iterator/BPy_Interface0DIterator.h"
|
||||
#include "Interface1D/BPy_Stroke.h"
|
||||
#include "Interface1D/BPy_ViewEdge.h"
|
||||
#include "BPy_ViewShape.h"
|
||||
|
||||
#include "UnaryFunction0D/BPy_UnaryFunction0DDouble.h"
|
||||
#include "UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h"
|
||||
#include "UnaryFunction0D/BPy_UnaryFunction0DFloat.h"
|
||||
#include "UnaryFunction0D/BPy_UnaryFunction0DId.h"
|
||||
#include "UnaryFunction0D/BPy_UnaryFunction0DMaterial.h"
|
||||
#include "UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h"
|
||||
#include "UnaryFunction0D/BPy_UnaryFunction0DVec2f.h"
|
||||
#include "UnaryFunction0D/BPy_UnaryFunction0DVec3f.h"
|
||||
#include "UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h"
|
||||
#include "UnaryFunction0D/BPy_UnaryFunction0DViewShape.h"
|
||||
|
||||
// BinaryPredicate0D: __call__
|
||||
bool Director_BPy_BinaryPredicate0D___call__( PyObject *obj, Interface0D& i1, Interface0D& i2) {
|
||||
@@ -61,17 +76,58 @@ ViewEdge * Director_BPy_ChainingIterator_traverse( PyObject *obj, AdjacencyItera
|
||||
return ((BPy_ViewEdge *) result)->ve;
|
||||
}
|
||||
|
||||
|
||||
// BPy_UnaryFunction{0D,1D}: __call__
|
||||
// BPy_UnaryFunction0DDouble
|
||||
// BPy_UnaryFunction0DEdgeNature
|
||||
// BPy_UnaryFunction0DFloat
|
||||
// BPy_UnaryFunction0DId
|
||||
// BPy_UnaryFunction0DMaterial
|
||||
// BPy_UnaryFunction0DUnsigned
|
||||
// BPy_UnaryFunction0DVec2f
|
||||
// BPy_UnaryFunction0DVec3f
|
||||
// BPy_UnaryFunction0DVectorViewShape
|
||||
// BPy_UnaryFunction0DViewShape
|
||||
void Director_BPy_UnaryFunction0D___call__( void *uf0D, PyObject *obj, Interface0DIterator& if0D_it) {
|
||||
|
||||
PyObject *result = PyObject_CallMethod( obj, "__call__", "O", BPy_Interface0DIterator_from_Interface0DIterator(if0D_it) );
|
||||
|
||||
if( BPy_UnaryFunction0DDouble_Check(obj) ) {
|
||||
((UnaryFunction0D<double> *) uf0D)->result = PyFloat_AsDouble(result);
|
||||
|
||||
} else if ( BPy_UnaryFunction0DEdgeNature_Check(obj) ) {
|
||||
((UnaryFunction0D<Nature::EdgeNature> *) uf0D)->result = EdgeNature_from_BPy_Nature(result);
|
||||
|
||||
} else if ( BPy_UnaryFunction0DFloat_Check(obj) ) {
|
||||
|
||||
((UnaryFunction0D<float> *) uf0D)->result = PyFloat_AsDouble(result);
|
||||
|
||||
} else if ( BPy_UnaryFunction0DId_Check(obj) ) {
|
||||
((UnaryFunction0D<Id> *) uf0D)->result = *( ((BPy_Id *) result)->id );
|
||||
|
||||
} else if ( BPy_UnaryFunction0DMaterial_Check(obj) ) {
|
||||
((UnaryFunction0D<Material> *) uf0D)->result = *( ((BPy_FrsMaterial *) result)->m );
|
||||
|
||||
} else if ( BPy_UnaryFunction0DUnsigned_Check(obj) ) {
|
||||
((UnaryFunction0D<unsigned> *) uf0D)->result = PyInt_AsLong(result);
|
||||
|
||||
} else if ( BPy_UnaryFunction0DVec2f_Check(obj) ) {
|
||||
Vec2f *v = Vec2f_ptr_from_Vector( result );
|
||||
((UnaryFunction0D<Vec2f> *) uf0D)->result = *v;
|
||||
delete v;
|
||||
|
||||
} else if ( BPy_UnaryFunction0DVec3f_Check(obj) ) {
|
||||
Vec3f *v = Vec3f_ptr_from_Vector( result );
|
||||
((UnaryFunction0D<Vec3f> *) uf0D)->result = *v;
|
||||
delete v;
|
||||
|
||||
} else if ( BPy_UnaryFunction0DVectorViewShape_Check(obj) ) {
|
||||
vector<ViewShape*> vec;
|
||||
for( int i = 0; i < PyList_Size(result); i++) {
|
||||
ViewShape *b = ( (BPy_ViewShape *) PyList_GetItem(result, i) )->vs;
|
||||
vec.push_back( b );
|
||||
}
|
||||
|
||||
((UnaryFunction0D< vector<ViewShape*> > *) uf0D)->result = vec;
|
||||
|
||||
} else if ( BPy_UnaryFunction0DViewShape_Check(obj) ) {
|
||||
((UnaryFunction0D<ViewShape*> *) uf0D)->result = ((BPy_ViewShape *) result)->vs;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Director_BPy_UnaryFunction1D___call__( void *uf1D, PyObject *obj, Interface1D& if1D) {
|
||||
|
||||
// BPy_UnaryFunction1DDouble
|
||||
// BPy_UnaryFunction1DEdgeNature
|
||||
@@ -82,6 +138,10 @@ ViewEdge * Director_BPy_ChainingIterator_traverse( PyObject *obj, AdjacencyItera
|
||||
// BPy_UnaryFunction1DVectorViewShape
|
||||
// BPy_UnaryFunction1DVoid
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// BPy_Iterator: increment, decrement, isBegin, isEnd
|
||||
void Director_BPy_Iterator_increment( PyObject *obj ) {
|
||||
PyObject_CallMethod( obj, "increment", "", 0 );
|
||||
@@ -103,5 +163,28 @@ bool Director_BPy_Iterator_isEnd( PyObject *obj ) {
|
||||
return bool_from_PyBool(result);
|
||||
}
|
||||
|
||||
// BPy_Interface1D: verticesBegin, verticesEnd, pointsBegin, pointsEnd
|
||||
Interface0DIterator Director_BPy_Interface1D_verticesBegin( PyObject *obj ){
|
||||
PyObject *result = PyObject_CallMethod( obj, "verticesBegin", "", 0 );
|
||||
|
||||
return *( ((BPy_Interface0DIterator *) result)->if0D_it );
|
||||
}
|
||||
|
||||
Interface0DIterator Director_BPy_Interface1D_verticesEnd( PyObject *obj ){
|
||||
PyObject *result = PyObject_CallMethod( obj, "verticesEnd", "", 0 );
|
||||
|
||||
return *( ((BPy_Interface0DIterator *) result)->if0D_it );
|
||||
}
|
||||
|
||||
Interface0DIterator Director_BPy_Interface1D_pointsBegin( PyObject *obj ){
|
||||
PyObject *result = PyObject_CallMethod( obj, "pointsBegin", "", 0 );
|
||||
|
||||
return *( ((BPy_Interface0DIterator *) result)->if0D_it );
|
||||
}
|
||||
|
||||
Interface0DIterator Director_BPy_Interface1D_pointsEnd( PyObject *obj ){
|
||||
PyObject *result = PyObject_CallMethod( obj, "pointsEnd", "", 0 );
|
||||
|
||||
return *( ((BPy_Interface0DIterator *) result)->if0D_it );
|
||||
}
|
||||
|
||||
|
||||
@@ -37,27 +37,9 @@ void Director_BPy_StrokeShader_shade( PyObject *obj, Stroke& s);
|
||||
void Director_BPy_ChainingIterator_init( PyObject *obj );
|
||||
ViewEdge * Director_BPy_ChainingIterator_traverse( PyObject *obj, AdjacencyIterator& a_it );
|
||||
|
||||
// BPy_UnaryFunction0DDouble
|
||||
double Director_BPy_UnaryFunction0DDouble___call__( PyObject *obj, Interface0DIterator& if0D_it);
|
||||
// BPy_UnaryFunction0DEdgeNature
|
||||
// BPy_UnaryFunction0DFloat
|
||||
// BPy_UnaryFunction0DId
|
||||
// BPy_UnaryFunction0DMaterial
|
||||
// BPy_UnaryFunction0DUnsigned
|
||||
// BPy_UnaryFunction0DVec2f
|
||||
// BPy_UnaryFunction0DVec3f
|
||||
// BPy_UnaryFunction0DVectorViewShape
|
||||
// BPy_UnaryFunction0DViewShape
|
||||
|
||||
// BPy_UnaryFunction1DDouble
|
||||
// BPy_UnaryFunction1DEdgeNature
|
||||
// BPy_UnaryFunction1DFloat
|
||||
// BPy_UnaryFunction1DUnsigned
|
||||
// BPy_UnaryFunction1DVec2f
|
||||
// BPy_UnaryFunction1DVec3f
|
||||
// BPy_UnaryFunction1DVectorViewShape
|
||||
// BPy_UnaryFunction1DVoid
|
||||
void Director_BPy_UnaryFunction1DVoid___call__( PyObject *obj, Interface1D& if1D);
|
||||
// BPy_UnaryFunction{0D,1D}: __call__
|
||||
void Director_BPy_UnaryFunction0D___call__( void *uf0D, PyObject *obj, Interface0DIterator& if0D_it);
|
||||
void Director_BPy_UnaryFunction1D___call__( void *uf1D, PyObject *obj, Interface1D& if1D);
|
||||
|
||||
// BPy_Iterator: increment, decrement, isBegin, isEnd
|
||||
void Director_BPy_Iterator_increment( PyObject *obj );
|
||||
@@ -65,4 +47,12 @@ void Director_BPy_Iterator_decrement( PyObject *obj );
|
||||
bool Director_BPy_Iterator_isBegin( PyObject *obj );
|
||||
bool Director_BPy_Iterator_isEnd( PyObject *obj );
|
||||
|
||||
// BPy_Interface1D: verticesBegin, verticesEnd, pointsBegin, pointsEnd
|
||||
Interface0DIterator Director_BPy_Interface1D_verticesBegin( PyObject *obj );
|
||||
Interface0DIterator Director_BPy_Interface1D_verticesEnd( PyObject *obj );
|
||||
Interface0DIterator Director_BPy_Interface1D_pointsBegin( PyObject *obj );
|
||||
Interface0DIterator Director_BPy_Interface1D_pointsEnd( PyObject *obj );
|
||||
|
||||
|
||||
|
||||
#endif // FREESTYLE_PYTHON_DIRECTOR
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h"
|
||||
#include "UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h"
|
||||
|
||||
#include "../Director.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -190,6 +192,7 @@ PyMODINIT_FUNC UnaryFunction0DDouble_Init( PyObject *module ) {
|
||||
int UnaryFunction0DDouble___init__(BPy_UnaryFunction0DDouble* self)
|
||||
{
|
||||
self->uf0D_double = new UnaryFunction0D<double>();
|
||||
self->uf0D_double->py_uf0D = (PyObject *)self;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -219,7 +222,8 @@ PyObject * UnaryFunction0DDouble___call__( BPy_UnaryFunction0DDouble *self, PyOb
|
||||
return NULL;
|
||||
}
|
||||
|
||||
double d = self->uf0D_double->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it ));
|
||||
double d = self->uf0D_double->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it));
|
||||
|
||||
return PyFloat_FromDouble( d );
|
||||
|
||||
}
|
||||
|
||||
@@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DEdgeNature_Init( PyObject *module ) {
|
||||
int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature* self)
|
||||
{
|
||||
self->uf0D_edgenature = new UnaryFunction0D<Nature::EdgeNature>();
|
||||
self->uf0D_edgenature->py_uf0D = (PyObject *)self;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -164,6 +164,7 @@ PyMODINIT_FUNC UnaryFunction0DFloat_Init( PyObject *module ) {
|
||||
int UnaryFunction0DFloat___init__(BPy_UnaryFunction0DFloat* self)
|
||||
{
|
||||
self->uf0D_float = new UnaryFunction0D<float>();
|
||||
self->uf0D_float->py_uf0D = (PyObject *)self;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DId_Init( PyObject *module ) {
|
||||
int UnaryFunction0DId___init__(BPy_UnaryFunction0DId* self)
|
||||
{
|
||||
self->uf0D_id = new UnaryFunction0D<Id>();
|
||||
self->uf0D_id->py_uf0D = (PyObject *)self;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DMaterial_Init( PyObject *module ) {
|
||||
int UnaryFunction0DMaterial___init__(BPy_UnaryFunction0DMaterial* self)
|
||||
{
|
||||
self->uf0D_material = new UnaryFunction0D<Material>();
|
||||
self->uf0D_material->py_uf0D = (PyObject *)self;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DUnsigned_Init( PyObject *module ) {
|
||||
int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned* self)
|
||||
{
|
||||
self->uf0D_unsigned = new UnaryFunction0D<unsigned int>();
|
||||
self->uf0D_unsigned->py_uf0D = (PyObject *)self;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,6 +141,7 @@ PyMODINIT_FUNC UnaryFunction0DVec2f_Init( PyObject *module ) {
|
||||
int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f* self)
|
||||
{
|
||||
self->uf0D_vec2f = new UnaryFunction0D<Vec2f>();
|
||||
self->uf0D_vec2f->py_uf0D = (PyObject *)self;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DVec3f_Init( PyObject *module ) {
|
||||
int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f* self)
|
||||
{
|
||||
self->uf0D_vec3f = new UnaryFunction0D<Vec3f>();
|
||||
self->uf0D_vec3f->py_uf0D = (PyObject *)self;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DVectorViewShape_Init( PyObject *module ) {
|
||||
int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorViewShape* self)
|
||||
{
|
||||
self->uf0D_vectorviewshape = new UnaryFunction0D< std::vector<ViewShape*> >();
|
||||
self->uf0D_vectorviewshape->py_uf0D = (PyObject *)self;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,6 +141,7 @@ PyMODINIT_FUNC UnaryFunction0DViewShape_Init( PyObject *module ) {
|
||||
int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape* self)
|
||||
{
|
||||
self->uf0D_viewshape = new UnaryFunction0D<ViewShape*>();
|
||||
self->uf0D_viewshape->py_uf0D = (PyObject *)self;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -231,6 +231,8 @@ int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble* self, PyObject *ar
|
||||
self->uf1D_double = new UnaryFunction1D<double>( IntegrationType_from_BPy_IntegrationType(obj) );
|
||||
}
|
||||
|
||||
self->uf1D_double->py_uf1D = (PyObject *)self;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -152,6 +152,8 @@ int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature* self, PyOb
|
||||
self->uf1D_edgenature = new UnaryFunction1D<Nature::EdgeNature>( IntegrationType_from_BPy_IntegrationType(obj) );
|
||||
}
|
||||
|
||||
self->uf1D_edgenature->py_uf1D = (PyObject *)self;
|
||||
|
||||
return 0;
|
||||
}
|
||||
void UnaryFunction1DEdgeNature___dealloc__(BPy_UnaryFunction1DEdgeNature* self)
|
||||
|
||||
@@ -145,6 +145,8 @@ int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat* self, PyObject *args
|
||||
self->uf1D_float = new UnaryFunction1D<float>( IntegrationType_from_BPy_IntegrationType(obj) );
|
||||
}
|
||||
|
||||
self->uf1D_float->py_uf1D = (PyObject *)self;
|
||||
|
||||
return 0;
|
||||
}
|
||||
void UnaryFunction1DFloat___dealloc__(BPy_UnaryFunction1DFloat* self)
|
||||
|
||||
@@ -152,6 +152,8 @@ int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned* self, PyObject
|
||||
self->uf1D_unsigned = new UnaryFunction1D<unsigned int>( IntegrationType_from_BPy_IntegrationType(obj) );
|
||||
}
|
||||
|
||||
self->uf1D_unsigned->py_uf1D = (PyObject *)self;
|
||||
|
||||
return 0;
|
||||
}
|
||||
void UnaryFunction1DUnsigned___dealloc__(BPy_UnaryFunction1DUnsigned* self)
|
||||
|
||||
@@ -158,6 +158,8 @@ int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f* self, PyObject *args
|
||||
self->uf1D_vec2f = new UnaryFunction1D<Vec2f>( IntegrationType_from_BPy_IntegrationType(obj) );
|
||||
}
|
||||
|
||||
self->uf1D_vec2f->py_uf1D = (PyObject *)self;
|
||||
|
||||
return 0;
|
||||
}
|
||||
void UnaryFunction1DVec2f___dealloc__(BPy_UnaryFunction1DVec2f* self)
|
||||
|
||||
@@ -152,6 +152,8 @@ int UnaryFunction1DVec3f___init__(BPy_UnaryFunction1DVec3f* self, PyObject *args
|
||||
self->uf1D_vec3f = new UnaryFunction1D<Vec3f>( IntegrationType_from_BPy_IntegrationType(obj) );
|
||||
}
|
||||
|
||||
self->uf1D_vec3f->py_uf1D = (PyObject *)self;
|
||||
|
||||
return 0;
|
||||
}
|
||||
void UnaryFunction1DVec3f___dealloc__(BPy_UnaryFunction1DVec3f* self)
|
||||
|
||||
@@ -165,6 +165,8 @@ int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorViewShape*
|
||||
self->uf1D_vectorviewshape = new UnaryFunction1D< std::vector<ViewShape*> >( IntegrationType_from_BPy_IntegrationType(obj) );
|
||||
}
|
||||
|
||||
self->uf1D_vectorviewshape->py_uf1D = (PyObject *)self;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -161,11 +161,13 @@ int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid* self, PyObject *args)
|
||||
}
|
||||
|
||||
if( !obj )
|
||||
self->uf1D_void = new UnaryFunction1D<void>();
|
||||
self->uf1D_void = new UnaryFunction1D_void();
|
||||
else {
|
||||
self->uf1D_void = new UnaryFunction1D<void>( IntegrationType_from_BPy_IntegrationType(obj) );
|
||||
self->uf1D_void = new UnaryFunction1D_void( IntegrationType_from_BPy_IntegrationType(obj) );
|
||||
}
|
||||
|
||||
self->uf1D_void->py_uf1D = (PyObject *)self;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ extern PyTypeObject UnaryFunction1DVoid_Type;
|
||||
/*---------------------------Python BPy_UnaryFunction1DVoid structure definition----------*/
|
||||
typedef struct {
|
||||
BPy_UnaryFunction1D py_uf1D;
|
||||
UnaryFunction1D<void> *uf1D_void;
|
||||
UnaryFunction1D_void *uf1D_void;
|
||||
} BPy_UnaryFunction1DVoid;
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction1DVoid visible prototypes-----------*/
|
||||
|
||||
@@ -65,7 +65,7 @@ void Operators::select(UnaryPredicate1D& pred) {
|
||||
|
||||
void Operators::chain(ViewEdgeInternal::ViewEdgeIterator& it,
|
||||
UnaryPredicate1D& pred,
|
||||
UnaryFunction1D<void>& modifier) {
|
||||
UnaryFunction1D_void& modifier) {
|
||||
if (_current_view_edges_set.empty())
|
||||
return;
|
||||
|
||||
@@ -137,7 +137,7 @@ void Operators::chain(ViewEdgeInternal::ViewEdgeIterator& it,
|
||||
|
||||
//void Operators::bidirectionalChain(ViewEdgeIterator& it,
|
||||
// UnaryPredicate1D& pred,
|
||||
// UnaryFunction1D<void>& modifier) {
|
||||
// UnaryFunction1D_void& modifier) {
|
||||
// if (_current_view_edges_set.empty())
|
||||
// return;
|
||||
//
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
*/
|
||||
static void chain(ViewEdgeInternal::ViewEdgeIterator& it,
|
||||
UnaryPredicate1D& pred,
|
||||
UnaryFunction1D<void>& modifier);
|
||||
UnaryFunction1D_void& modifier);
|
||||
|
||||
/*! Builds a set of chains from the current set of ViewEdges.
|
||||
* Each ViewEdge of the current list starts a new chain. The chaining
|
||||
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
virtual bool operator()(Interface1D& inter1, Interface1D& inter2) {
|
||||
string name( py_bp1D ? PyString_AsString(PyObject_CallMethod(py_bp1D, "getName", "")) : getName() );
|
||||
|
||||
if( py_bp1D && py_bp1D && PyObject_HasAttrString(py_bp1D, "__call__") ) {
|
||||
if( py_bp1D && PyObject_HasAttrString(py_bp1D, "__call__") ) {
|
||||
return Director_BPy_BinaryPredicate1D___call__(py_bp1D, inter1, inter2);
|
||||
} else {
|
||||
cerr << "Warning: " << name << " operator() not implemented" << endl;
|
||||
|
||||
@@ -404,9 +404,11 @@ Stroke::Stroke(const Stroke& iBrother)
|
||||
_mediumType = iBrother._mediumType;
|
||||
_textureId = iBrother._textureId;
|
||||
_tips = iBrother._tips;
|
||||
|
||||
if(iBrother._rep)
|
||||
|
||||
if( iBrother._rep )
|
||||
_rep = new StrokeRep(*(iBrother._rep));
|
||||
else
|
||||
_rep = new StrokeRep(this);
|
||||
}
|
||||
|
||||
Stroke::~Stroke()
|
||||
|
||||
@@ -43,6 +43,8 @@ class SShape;
|
||||
|
||||
using namespace Geometry;
|
||||
|
||||
#include "../python/Director.h"
|
||||
|
||||
//
|
||||
// UnaryFunction0D (base class for functions in 0D)
|
||||
//
|
||||
@@ -70,12 +72,15 @@ class /*LIB_VIEW_MAP_EXPORT*/ UnaryFunction0D
|
||||
{
|
||||
public:
|
||||
|
||||
T result;
|
||||
PyObject *py_uf0D;
|
||||
|
||||
/*! The type of the value
|
||||
* returned by the functor.
|
||||
*/
|
||||
typedef T ReturnedValueType;
|
||||
/*! Default constructor. */
|
||||
UnaryFunction0D() {}
|
||||
UnaryFunction0D() { py_uf0D = 0;}
|
||||
/*! Destructor; */
|
||||
virtual ~UnaryFunction0D() {}
|
||||
/*! Returns the string "UnaryFunction0D" */
|
||||
@@ -90,9 +95,17 @@ public:
|
||||
* \return the result of the function of type T.
|
||||
*/
|
||||
virtual T operator()(Interface0DIterator& iter) {
|
||||
cerr << "Warning: UnaryFunction0D operator() not implemented" << endl;
|
||||
return T();
|
||||
string name( py_uf0D ? PyString_AsString(PyObject_CallMethod(py_uf0D, "getName", "")) : getName() );
|
||||
|
||||
if( py_uf0D && PyObject_HasAttrString(py_uf0D, "__call__") ) {
|
||||
Director_BPy_UnaryFunction0D___call__( this, py_uf0D, iter);
|
||||
return result;
|
||||
} else {
|
||||
cerr << "Warning: " << name << " operator() not implemented" << endl;
|
||||
return T();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
# ifdef SWIG
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
# include "Functions0D.h"
|
||||
# include "Interface1D.h"
|
||||
# include "../system/FreestyleConfig.h"
|
||||
|
||||
#include "../python/Director.h"
|
||||
|
||||
//
|
||||
// UnaryFunction1D (base class for functions in 1D)
|
||||
//
|
||||
@@ -62,6 +65,10 @@ template <class T>
|
||||
class /*LIB_VIEW_MAP_EXPORT*/ UnaryFunction1D
|
||||
{
|
||||
public:
|
||||
|
||||
T result;
|
||||
PyObject *py_uf1D;
|
||||
|
||||
/*! The type of the value
|
||||
* returned by the functor.
|
||||
*/
|
||||
@@ -92,9 +99,17 @@ public:
|
||||
* \return the result of the function of type T.
|
||||
*/
|
||||
virtual T operator()(Interface1D& inter) {
|
||||
cerr << "Warning: UnaryFunction1D operator() not implemented" << endl;
|
||||
return T(0);
|
||||
string name( py_uf1D ? PyString_AsString(PyObject_CallMethod(py_uf1D, "getName", "")) : getName() );
|
||||
|
||||
if( py_uf1D && PyObject_HasAttrString(py_uf1D, "__call__") ) {
|
||||
Director_BPy_UnaryFunction1D___call__( this, py_uf1D, inter);
|
||||
return result;
|
||||
} else {
|
||||
cerr << "Warning: " << name << " operator() not implemented" << endl;
|
||||
return T(0);
|
||||
}
|
||||
}
|
||||
|
||||
/*! Sets the integration method */
|
||||
void setIntegrationType(IntegrationType integration) {
|
||||
_integration = integration;
|
||||
@@ -109,22 +124,37 @@ protected:
|
||||
IntegrationType _integration;
|
||||
};
|
||||
|
||||
# ifdef SWIG
|
||||
%feature("director") UnaryFunction1D<void>;
|
||||
%feature("director") UnaryFunction1D<unsigned>;
|
||||
%feature("director") UnaryFunction1D<float>;
|
||||
%feature("director") UnaryFunction1D<double>;
|
||||
%feature("director") UnaryFunction1D<Vec2f>;
|
||||
%feature("director") UnaryFunction1D<Vec3f>;
|
||||
|
||||
%template(UnaryFunction1DVoid) UnaryFunction1D<void>;
|
||||
%template(UnaryFunction1DUnsigned) UnaryFunction1D<unsigned>;
|
||||
%template(UnaryFunction1DFloat) UnaryFunction1D<float>;
|
||||
%template(UnaryFunction1DDouble) UnaryFunction1D<double>;
|
||||
%template(UnaryFunction1DVec2f) UnaryFunction1D<Vec2f>;
|
||||
%template(UnaryFunction1DVec3f) UnaryFunction1D<Vec3f>;
|
||||
%template(UnaryFunction1DVectorViewShape) UnaryFunction1D<std::vector<ViewShape*> >;
|
||||
# endif // SWIG
|
||||
class UnaryFunction1D_void
|
||||
{
|
||||
public:
|
||||
|
||||
PyObject *py_uf1D;
|
||||
|
||||
UnaryFunction1D_void(){_integration = MEAN;}
|
||||
UnaryFunction1D_void(IntegrationType iType){_integration = iType;}
|
||||
virtual ~UnaryFunction1D_void() {}
|
||||
|
||||
virtual string getName() const {
|
||||
return "UnaryFunction1D_void";
|
||||
}
|
||||
|
||||
void operator()(Interface1D& inter) {
|
||||
string name( py_uf1D ? PyString_AsString(PyObject_CallMethod(py_uf1D, "getName", "")) : getName() );
|
||||
|
||||
if( py_uf1D && PyObject_HasAttrString(py_uf1D, "__call__") ) {
|
||||
Director_BPy_UnaryFunction1D___call__( this, py_uf1D, inter);
|
||||
} else {
|
||||
cerr << "Warning: " << name << " operator() not implemented" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void setIntegrationType(IntegrationType integration) { _integration = integration; }
|
||||
IntegrationType getIntegrationType() const { return _integration; }
|
||||
|
||||
protected:
|
||||
IntegrationType _integration;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
@@ -385,7 +415,7 @@ namespace Functions1D {
|
||||
|
||||
// TimeStampF1D
|
||||
/*! Returns the time stamp of the Interface1D. */
|
||||
class LIB_VIEW_MAP_EXPORT TimeStampF1D : public UnaryFunction1D<void>
|
||||
class LIB_VIEW_MAP_EXPORT TimeStampF1D : public UnaryFunction1D_void
|
||||
{
|
||||
public:
|
||||
/*! Returns the string "TimeStampF1D"*/
|
||||
@@ -398,7 +428,7 @@ namespace Functions1D {
|
||||
|
||||
// IncrementChainingTimeStampF1D
|
||||
/*! Increments the chaining time stamp of the Interface1D. */
|
||||
class LIB_VIEW_MAP_EXPORT IncrementChainingTimeStampF1D : public UnaryFunction1D<void>
|
||||
class LIB_VIEW_MAP_EXPORT IncrementChainingTimeStampF1D : public UnaryFunction1D_void
|
||||
{
|
||||
public:
|
||||
/*! Returns the string "IncrementChainingTimeStampF1D"*/
|
||||
@@ -411,7 +441,7 @@ namespace Functions1D {
|
||||
|
||||
// ChainingTimeStampF1D
|
||||
/*! Sets the chaining time stamp of the Interface1D. */
|
||||
class LIB_VIEW_MAP_EXPORT ChainingTimeStampF1D : public UnaryFunction1D<void>
|
||||
class LIB_VIEW_MAP_EXPORT ChainingTimeStampF1D : public UnaryFunction1D_void
|
||||
{
|
||||
public:
|
||||
/*! Returns the string "ChainingTimeStampF1D"*/
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
# include "../winged_edge/Nature.h"
|
||||
# include "Functions0D.h"
|
||||
|
||||
#include "../python/Director.h"
|
||||
|
||||
using namespace std;
|
||||
/*! \file Interface1D.h
|
||||
* Interface1D and related tools definitions
|
||||
@@ -125,8 +127,10 @@ class Interface1D
|
||||
{
|
||||
public:
|
||||
|
||||
PyObject *py_if1D;
|
||||
|
||||
/*! Default constructor */
|
||||
Interface1D() {_timeStamp=0;}
|
||||
Interface1D() {_timeStamp=0; py_if1D = 0; }
|
||||
virtual ~Interface1D() {}; //soc
|
||||
|
||||
/*! Returns the string "Interface1D" .*/
|
||||
@@ -140,16 +144,28 @@ public:
|
||||
* pointing to the first vertex.
|
||||
*/
|
||||
virtual Interface0DIterator verticesBegin() {
|
||||
cerr << "Warning: method verticesBegin() not implemented" << endl;
|
||||
return Interface0DIterator();
|
||||
string name( py_if1D ? PyString_AsString(PyObject_CallMethod(py_if1D, "getExactTypeName", "")) : getExactTypeName() );
|
||||
|
||||
if( py_if1D && PyObject_HasAttrString(py_if1D, "verticesBegin") ) {
|
||||
return Director_BPy_Interface1D_verticesBegin(py_if1D);
|
||||
} else {
|
||||
cerr << "Warning: " << name << " verticesBegin() not implemented" << endl;
|
||||
return Interface0DIterator();
|
||||
}
|
||||
}
|
||||
|
||||
/*! Returns an iterator over the Interface1D vertices,
|
||||
* pointing after the last vertex.
|
||||
*/
|
||||
virtual Interface0DIterator verticesEnd(){
|
||||
cerr << "Warning: method verticesEnd() not implemented" << endl;
|
||||
return Interface0DIterator();
|
||||
string name( py_if1D ? PyString_AsString(PyObject_CallMethod(py_if1D, "getExactTypeName", "")) : getExactTypeName() );
|
||||
|
||||
if( py_if1D && PyObject_HasAttrString(py_if1D, "verticesEnd") ) {
|
||||
return Director_BPy_Interface1D_verticesEnd(py_if1D);
|
||||
} else {
|
||||
cerr << "Warning: " << name << " verticesEnd() not implemented" << endl;
|
||||
return Interface0DIterator();
|
||||
}
|
||||
}
|
||||
|
||||
/*! Returns an iterator over the Interface1D points,
|
||||
@@ -162,8 +178,14 @@ public:
|
||||
* this 1D element.
|
||||
*/
|
||||
virtual Interface0DIterator pointsBegin(float t=0.f) {
|
||||
cerr << "Warning: method pointsBegin() not implemented" << endl;
|
||||
return Interface0DIterator();
|
||||
string name( py_if1D ? PyString_AsString(PyObject_CallMethod(py_if1D, "getExactTypeName", "")) : getExactTypeName() );
|
||||
|
||||
if( py_if1D && PyObject_HasAttrString(py_if1D, "pointsBegin") ) {
|
||||
return Director_BPy_Interface1D_pointsBegin(py_if1D);
|
||||
} else {
|
||||
cerr << "Warning: " << name << " pointsBegin() not implemented" << endl;
|
||||
return Interface0DIterator();
|
||||
}
|
||||
}
|
||||
|
||||
/*! Returns an iterator over the Interface1D points,
|
||||
@@ -176,8 +198,14 @@ public:
|
||||
* this 1D element.
|
||||
*/
|
||||
virtual Interface0DIterator pointsEnd(float t=0.f) {
|
||||
cerr << "Warning: method pointsEnd() not implemented" << endl;
|
||||
return Interface0DIterator();
|
||||
string name( py_if1D ? PyString_AsString(PyObject_CallMethod(py_if1D, "getExactTypeName", "")) : getExactTypeName() );
|
||||
|
||||
if( py_if1D && PyObject_HasAttrString(py_if1D, "pointsEnd") ) {
|
||||
return Director_BPy_Interface1D_pointsEnd(py_if1D);
|
||||
} else {
|
||||
cerr << "Warning: " << name << " pointsEnd() not implemented" << endl;
|
||||
return Interface0DIterator();
|
||||
}
|
||||
}
|
||||
|
||||
// Data access methods
|
||||
|
||||
Reference in New Issue
Block a user