X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROPy%2FHYDROData_Entity.sip;h=344d691a3f7db18c609d49ef90108a1c9d1b23fd;hb=3bece499e83cc9ca95536228c7f6740030e9d5d8;hp=fda3ec35f600f2b261d308cce52eb00da927b7ba;hpb=6527cd5d3063b2724b60b3f87ed1105244b74cb3;p=modules%2Fhydro.git diff --git a/src/HYDROPy/HYDROData_Entity.sip b/src/HYDROPy/HYDROData_Entity.sip index fda3ec35..344d691a 100644 --- a/src/HYDROPy/HYDROData_Entity.sip +++ b/src/HYDROPy/HYDROData_Entity.sip @@ -45,6 +45,7 @@ const ObjectKind KIND_SPLIT_GROUP; const ObjectKind KIND_OBSTACLE_ALTITUDE; const ObjectKind KIND_STRICKLER_TABLE; const ObjectKind KIND_LAND_COVER_MAP; +const ObjectKind KIND_BC_POLYGON; class HYDROData_Entity { @@ -127,7 +128,7 @@ class HYDROData_Entity case KIND_SHAPES_GROUP: sipClass = sipClass_HYDROData_ShapesGroup; break; - + case KIND_SPLIT_GROUP: sipClass = sipClass_HYDROData_SplitShapesGroup; break; @@ -148,6 +149,10 @@ class HYDROData_Entity sipClass = sipClass_HYDROData_LandCoverMap; break; + case KIND_BC_POLYGON: + sipClass = sipClass_HYDROData_BCPolygon; + break; + case KIND_UNKNOWN: sipClass = sipClass_HYDROData_Entity; break; @@ -183,7 +188,7 @@ public: /** * Updates the name of this object. */ - virtual void SetName(const QString& theName); + virtual void SetName(const QString& theName, bool isDefault = false ); /** * Updates object state. @@ -206,7 +211,7 @@ public: */ virtual bool CanBeUpdated() const; - + /** * Checks is object exists in the data structure. * \returns true is object is not exists in the data model @@ -222,15 +227,15 @@ public: * Returns father object. For object created under root document label * this method always return NULL object. */ - HYDROData_Entity GetFatherObject() const [Handle_HYDROData_Entity ()]; + HYDROData_Entity GetFatherObject() const [opencascade::handle ()]; %MethodCode Handle(HYDROData_Entity) aFather; - + Py_BEGIN_ALLOW_THREADS - aFather = sipSelfWasArg ? sipCpp->HYDROData_Entity::GetFatherObject() : + aFather = sipSelfWasArg ? sipCpp->HYDROData_Entity::GetFatherObject() : sipCpp->GetFatherObject(); Py_END_ALLOW_THREADS - + sipRes = createPointer( aFather ); %End @@ -244,7 +249,7 @@ public: /** * Returns the z-level for object presentation, -1 if no z-level. */ - virtual bool GetZLevel( int& theLevel ) const [Standard_Boolean ( Standard_Integer& )]; + virtual bool GetZLevel( int& theLevel ) const [bool ( Standard_Integer& )]; /** * Set the z-level for object presentation. @@ -256,11 +261,12 @@ public: */ virtual void RemoveZLevel(); + void SetColor( const QColor& theColor, const int theTag = 0 ); protected: /** - * Creates new object in the internal data structure. Use higher level objects + * Creates new object in the internal data structure. Use higher level objects * to create objects with real content. */ HYDROData_Entity( Geometry ); @@ -269,5 +275,93 @@ protected: * Destructs properties of the object and object itself, removes it from the document. */ virtual ~HYDROData_Entity(); - + +}; + + +%MappedType std::vector +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + // Create the list. + PyObject *l; + + if ( ( l = PyList_New( sipCpp->size() ) ) == NULL ) + return NULL; + + // Set the list elements. + for ( int i = 0, n = sipCpp->size(); i < n; ++i ) + { + HYDROData_Entity* t = (*sipCpp)[i]; //new HYDROData_Entity( ( sipCpp)[i] ); + + PyObject* pobj; + if ( ( pobj = sipConvertFromNewType( t, sipType_HYDROData_Entity, sipTransferObj ) ) == NULL ) + { + Py_DECREF( l ); + //delete t; + + return NULL; + } + + PyList_SET_ITEM( l, i, pobj ); + } + + return l; +%End + +%ConvertToTypeCode + SIP_SSIZE_T len; + + // Check the type if that is all that is required. + if (sipIsErr == NULL) + { + if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0) + return 0; + + for (SIP_SSIZE_T i = 0; i < len; ++i) + { + PyObject *itm = PySequence_ITEM(sipPy, i); + bool ok = (itm && sipCanConvertToType(itm, sipType_HYDROData_Entity, SIP_NOT_NONE)); + + Py_XDECREF(itm); + + if (!ok) + return 0; + } + + return 1; + } + + std::vector *aSeq = new std::vector; + len = PySequence_Size(sipPy); + aSeq->reserve( len ); + + for (SIP_SSIZE_T i = 0; i < len; ++i) + { + PyObject *itm = PySequence_ITEM(sipPy, i); + int state; + HYDROData_Entity *t = reinterpret_cast(sipConvertToType(itm, sipType_HYDROData_Entity, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); + + Py_DECREF(itm); + + if (*sipIsErr) + { + sipReleaseType(t, sipType_HYDROData_Entity, state); + + delete aSeq; + return 0; + } + + aSeq->push_back(t); + + sipReleaseType(t, sipType_HYDROData_Entity, state); + } + + *sipCppPtr = aSeq; + + return sipGetState(sipTransferObj); +%End };