From: adv Date: Tue, 17 Sep 2013 13:15:19 +0000 (+0000) Subject: Base implementation of Zone data object (Feature #31). X-Git-Tag: BR_hydro_v_0_1~24 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5bdd5a07050d0879edb5efdc7e009850a46c64f8;p=modules%2Fhydro.git Base implementation of Zone data object (Feature #31). --- diff --git a/src/HYDROData/HYDROData.vcproj b/src/HYDROData/HYDROData.vcproj index 7ea57957..bacb345f 100644 --- a/src/HYDROData/HYDROData.vcproj +++ b/src/HYDROData/HYDROData.vcproj @@ -165,6 +165,10 @@ RelativePath=".\HYDROData_VisualState.cxx" > + + @@ -242,6 +246,10 @@ RelativePath=".\HYDROData_VisualState.h" > + + diff --git a/src/HYDROData/HYDROData_Calculation.cxx b/src/HYDROData/HYDROData_Calculation.cxx index e22f7a57..c836f548 100644 --- a/src/HYDROData/HYDROData_Calculation.cxx +++ b/src/HYDROData/HYDROData_Calculation.cxx @@ -45,29 +45,11 @@ QStringList HYDROData_Calculation::DumpToPython( MapOfTreatedObjects& theTreated void HYDROData_Calculation::SetBoundaryPolyline( const Handle(HYDROData_Polyline)& thePolyline ) { - Handle(TDataStd_ReferenceList) aRefs; - myLab.FindChild( DataTag_BoundaryPolyline ).FindAttribute( TDataStd_ReferenceList::GetID(), aRefs ); - if ( aRefs.IsNull() ) - aRefs = TDataStd_ReferenceList::Set( myLab.FindChild( DataTag_BoundaryPolyline ) ); - - aRefs->Clear(); - - if ( thePolyline.IsNull() ) - return; - - aRefs->Append( thePolyline->Label() ); + SetReferenceObject( thePolyline, DataTag_BoundaryPolyline ); } Handle(HYDROData_Polyline) HYDROData_Calculation::GetBoundaryPolyline() const { - Handle(HYDROData_Polyline) aRes; - - Handle(TDataStd_ReferenceList) aRefs; - myLab.FindChild( DataTag_BoundaryPolyline ).FindAttribute( TDataStd_ReferenceList::GetID(), aRefs ); - if ( !aRefs.IsNull() && !aRefs->IsEmpty() ) - { - aRes = Handle(HYDROData_Polyline)::DownCast( HYDROData_Iterator::Object( aRefs->First() ) ); - } - - return aRes; + return Handle(HYDROData_Polyline)::DownCast( + GetReferenceObject( DataTag_BoundaryPolyline ) ); } diff --git a/src/HYDROData/HYDROData_Image.cxx b/src/HYDROData/HYDROData_Image.cxx index 5fe12bb0..362e1515 100644 --- a/src/HYDROData/HYDROData_Image.cxx +++ b/src/HYDROData/HYDROData_Image.cxx @@ -1,9 +1,9 @@ #include "HYDROData_Image.h" -#include "HYDROData_Iterator.h" -#include "HYDROOperations_Factory.h" +#include "HYDROData_Document.h" #include "HYDROData_Tool.h" +#include "HYDROOperations_Factory.h" #include #include @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -382,77 +381,35 @@ bool HYDROData_Image::HasTrsfPoints() const return myLab.FindChild(DataTag_TrsfPoints).FindAttribute(TDataStd_RealArray::GetID(), anArray); } -void HYDROData_Image::AppendReference(Handle(HYDROData_Object) theReferenced) +void HYDROData_Image::AppendReference( const Handle(HYDROData_Object)& theReferenced ) { - Handle(TDataStd_ReferenceList) aRefs; - if (!myLab.FindAttribute(TDataStd_ReferenceList::GetID(), aRefs)) - aRefs = TDataStd_ReferenceList::Set(myLab); - aRefs->Append(theReferenced->Label()); + AddReferenceObject( theReferenced, 0 ); } int HYDROData_Image::NbReferences() const { - Handle(TDataStd_ReferenceList) aRefs; - if (!myLab.FindAttribute(TDataStd_ReferenceList::GetID(), aRefs)) - return 0; - return aRefs->Extent(); + return NbReferenceObjects( 0 ); } -Handle(HYDROData_Object) HYDROData_Image::Reference(const int theIndex) const +Handle(HYDROData_Object) HYDROData_Image::Reference( const int theIndex ) const { - Handle(TDataStd_ReferenceList) aRefs; - if (!myLab.FindAttribute(TDataStd_ReferenceList::GetID(), aRefs)) - return Handle(HYDROData_Object)(); - if (theIndex < 0 || theIndex >= aRefs->Extent()) - return Handle(HYDROData_Object)(); - - TDF_ListIteratorOfLabelList anIter(aRefs->List()); - for(int anIndex = 0; anIndex != theIndex; anIter.Next(), anIndex++); - const TDF_Label& aRefLab = anIter.Value(); - return Handle(HYDROData_Object)::DownCast(HYDROData_Iterator::Object(aRefLab)); + return GetReferenceObject( 0, theIndex ); } void HYDROData_Image::ChangeReference( const int theIndex, Handle(HYDROData_Object) theReferenced) { - Handle(TDataStd_ReferenceList) aRefs; - if (!myLab.FindAttribute(TDataStd_ReferenceList::GetID(), aRefs)) - aRefs = TDataStd_ReferenceList::Set(myLab); - if (theIndex >= aRefs->Extent()) { // for too big index append it just to the end - AppendReference(theReferenced); - } else { // remove and insert new - TDF_ListIteratorOfLabelList anIter(aRefs->List()); - int anIndex = 0; - for(; anIndex != theIndex; anIter.Next(), anIndex++); - const TDF_Label& aRemovedLab = anIter.Value(); - anIter.Next(); - aRefs->Remove(aRemovedLab); - if (anIter.More()) - aRefs->InsertBefore(theReferenced->Label(), anIter.Value()); - else - aRefs->Append(theReferenced->Label()); - } + SetReferenceObject( theReferenced, 0, theIndex ); } void HYDROData_Image::RemoveReference(const int theIndex) { - Handle(TDataStd_ReferenceList) aRefs; - if (!myLab.FindAttribute(TDataStd_ReferenceList::GetID(), aRefs)) - return; // no references, nothing to remove - if (aRefs->Extent() == 1 && theIndex == 0) { // remove all if only one - ClearReferences(); - return; - } - TDF_ListIteratorOfLabelList anIter(aRefs->List()); - int anIndex = 0; - for(; anIndex != theIndex && anIter.More(); anIter.Next(), anIndex++); - if (anIter.More()) - aRefs->Remove(anIter.Value()); + RemoveReferenceObject( 0, theIndex ); } void HYDROData_Image::ClearReferences() { - myLab.ForgetAttribute(TDataStd_ReferenceList::GetID()); + ClearReferenceObjects( 0 ); } void HYDROData_Image::SetOperatorName(const QString theOpName) diff --git a/src/HYDROData/HYDROData_Image.h b/src/HYDROData/HYDROData_Image.h index 134a5b2e..16a691a6 100644 --- a/src/HYDROData/HYDROData_Image.h +++ b/src/HYDROData/HYDROData_Image.h @@ -134,7 +134,7 @@ public: * Appends reference to other object (image or polyline). * \param theReferenced the object referenced by this */ - HYDRODATA_EXPORT void AppendReference(Handle(HYDROData_Object) theReferenced); + HYDRODATA_EXPORT void AppendReference( const Handle(HYDROData_Object)& theReferenced ); /** * Returns the number of referenced objects diff --git a/src/HYDROData/HYDROData_Iterator.h b/src/HYDROData/HYDROData_Iterator.h index 8fc27f83..746366a6 100644 --- a/src/HYDROData/HYDROData_Iterator.h +++ b/src/HYDROData/HYDROData_Iterator.h @@ -42,8 +42,7 @@ public: protected: friend class HYDROData_Document; - friend class HYDROData_Image; - friend class HYDROData_Calculation; + friend class HYDROData_Object; /** * Creates object in the document, call HYDROData_Document method to create diff --git a/src/HYDROData/HYDROData_Object.cxx b/src/HYDROData/HYDROData_Object.cxx index 46d5b3a5..1be3985a 100644 --- a/src/HYDROData/HYDROData_Object.cxx +++ b/src/HYDROData/HYDROData_Object.cxx @@ -1,4 +1,7 @@ -#include + +#include "HYDROData_Object.h" + +#include "HYDROData_Iterator.h" #include #include @@ -6,7 +9,10 @@ #include #include #include +#include + #include +#include #include #include @@ -117,3 +123,130 @@ const char* HYDROData_Object::ByteArray(const int theTag, int& theLen) const return (const char*)(&(aData->InternalArray()->ChangeArray1().ChangeValue(1))); return NULL; } + +int HYDROData_Object::NbReferenceObjects( const int theTag ) const +{ + Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false ); + return aRefs.IsNull() ? 0 : aRefs->Extent(); +} + +void HYDROData_Object::AddReferenceObject( const Handle_HYDROData_Object& theObj, + const int theTag ) +{ + if ( theObj.IsNull() ) + return; + + Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, true ); + aRefs->Append( theObj->Label() ); +} + +void HYDROData_Object::SetReferenceObject( const Handle_HYDROData_Object& theObj, + const int theTag, + const int theIndex ) +{ + if ( theObj.IsNull() ) + return; + + Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, true ); + + if ( theIndex >= aRefs->Extent() ) + { + aRefs->Append( theObj->Label() ); + } + else if ( theIndex < 0 ) + { + aRefs->Prepend( theObj->Label() ); + } + else + { + RemoveReferenceObject( theTag, theIndex ); + + Handle(HYDROData_Object) aBeforeObj = GetReferenceObject( theTag, theIndex ); + + aRefs = getReferenceList( theTag, true ); // because reference list can be removed + if ( !aBeforeObj.IsNull() ) + aRefs->InsertBefore( theObj->Label(), aBeforeObj->Label() ); + else + aRefs->Append( theObj->Label() ); + } +} + +Handle(HYDROData_Object) HYDROData_Object::GetReferenceObject( const int theTag, + const int theIndex ) const +{ + Handle(HYDROData_Object) aRes; + + Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false ); + if ( aRefs.IsNull() || theIndex < 0 || theIndex >= aRefs->Extent() ) + return aRes; + + TDF_ListIteratorOfLabelList anIter( aRefs->List() ); + for ( int anIndex = 0; anIndex != theIndex && anIter.More(); anIter.Next(), ++anIndex ); + + const TDF_Label& aRefLabel = anIter.Value(); + aRes = HYDROData_Iterator::Object( aRefLabel ); + + return aRes; +} + +HYDROData_SequenceOfObjects HYDROData_Object::GetReferenceObjects( const int theTag ) const +{ + HYDROData_SequenceOfObjects aRes; + + Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false ); + if ( aRefs.IsNull() ) + return aRes; + + TDF_ListIteratorOfLabelList anIter( aRefs->List() ); + for ( ; anIter.More(); anIter.Next() ) + { + const TDF_Label& aRefLabel = anIter.Value(); + + Handle(HYDROData_Object) aRefObject = HYDROData_Iterator::Object( aRefLabel ); + if ( aRefObject.IsNull() ) + continue; + + aRes.Append( aRefObject ); + } + + return aRes; +} + +void HYDROData_Object::RemoveReferenceObject( const int theTag, + const int theIndex ) +{ + Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false ); + if ( aRefs.IsNull() ) + return; + + if ( aRefs->Extent() == 1 && theIndex == 0 ) + { + // remove all if only one + ClearReferenceObjects( theTag ); + return; + } + + Handle(HYDROData_Object) aRemovedObj = GetReferenceObject( theTag, theIndex ); + if ( aRemovedObj.IsNull() ) + return; + + aRefs->Remove( aRemovedObj->Label() ); +} + +void HYDROData_Object::ClearReferenceObjects( const int theTag ) +{ + TDF_Label aSetLabel = theTag == 0 ? myLab : myLab.FindChild( theTag ); + aSetLabel.ForgetAttribute( TDataStd_ReferenceList::GetID() ); +} + +Handle(TDataStd_ReferenceList) HYDROData_Object::getReferenceList( const int theTag, + const bool theIsCreate ) const +{ + TDF_Label aLabel = theTag == 0 ? myLab : myLab.FindChild( theTag ); + + Handle(TDataStd_ReferenceList) aRefs; + if ( !aLabel.FindAttribute( TDataStd_ReferenceList::GetID(), aRefs ) && theIsCreate ) + aRefs = TDataStd_ReferenceList::Set( aLabel ); + + return aRefs; +} diff --git a/src/HYDROData/HYDROData_Object.h b/src/HYDROData/HYDROData_Object.h index 595c6f9a..04e83ed9 100644 --- a/src/HYDROData/HYDROData_Object.h +++ b/src/HYDROData/HYDROData_Object.h @@ -10,21 +10,30 @@ class QString; class QVariant; class QStringList; +class Handle(TDataStd_ReferenceList); +class Handle_HYDROData_Object; ///! Kind of an object in a document typedef int ObjectKind; ///! Unrecognized object -const ObjectKind KIND_UNKNOWN = 0; -const ObjectKind KIND_IMAGE = 1; -const ObjectKind KIND_POLYLINE = 2; -const ObjectKind KIND_VISUAL_STATE = 3; -const ObjectKind KIND_BATHYMETRY = 4; -const ObjectKind KIND_CALCULATION = 5; +const ObjectKind KIND_UNKNOWN = 0; +const ObjectKind KIND_IMAGE = 1; +const ObjectKind KIND_POLYLINE = 2; +const ObjectKind KIND_VISUAL_STATE = 3; +const ObjectKind KIND_BATHYMETRY = 4; +const ObjectKind KIND_CALCULATION = 5; +const ObjectKind KIND_PROFILE = 6; +const ObjectKind KIND_PROFILES_GROUP = 7; +const ObjectKind KIND_GUIDE_LINE = 8; +const ObjectKind KIND_ZONE = 9; DEFINE_STANDARD_HANDLE(HYDROData_Object, MMgt_TShared) typedef QMap MapOfTreatedObjects; +typedef NCollection_Sequence HYDROData_SequenceOfObjects; + + /**\class HYDROData_Object * \brief Generic class of any object in the data model. * @@ -149,13 +158,70 @@ protected: */ const char* ByteArray(const int theTag, int& theLen) const; + /** + * Internal method that used to store the reference object label attribute + * \param theObj pointer to reference object + * \param theTag tag of a label to store attribute (for 0 this is myLab) + */ + int NbReferenceObjects( const int theTag = 0 ) const; + + /** + * Internal method that used to store the reference object label attribute + * \param theObj pointer to reference object + * \param theTag tag of a label to store attribute (for 0 this is myLab) + */ + void AddReferenceObject( const Handle_HYDROData_Object& theObj, + const int theTag = 0 ); + + /** + * Internal method that used to store the reference object label attribute + * \param theObj pointer to reference object + * \param theTag tag of a label to store attribute (for 0 this is myLab) + * \param theIndex index in the list of references + - if more that len then just append it to the end of list + - if less than zero then prepend to the list + - indexing starts from 0 + */ + void SetReferenceObject( const Handle_HYDROData_Object& theObj, + const int theTag = 0, + const int theIndex = 0 ); + + /** + * Internal method that used to retreive the reference object(s) attribute + * \param theTag tag of a label that keeps the attribute (for 0 this is myLab) + * \param theIndex index in the list of references + * - indexing starts from 0 + * \returns pointer to reference object or NULL if label is not set + */ + Handle_HYDROData_Object GetReferenceObject( const int theTag = 0, + const int theIndex = 0 ) const; + + HYDROData_SequenceOfObjects GetReferenceObjects( const int theTag = 0 ) const; + + /** + * Internal method that used to remove the reference object attribute + * \param theTag tag of a label that keeps the attribute (for 0 this is myLab) + * \param theIndex index in the list of references + * - indexing starts from 0 + */ + void RemoveReferenceObject( const int theTag = 0, const int theIndex = 0 ); + + /** + * Internal method that used to clear list of the reference objects attribute + * \param theTag tag of a label that keeps the attribute (for 0 this is myLab) + */ + void ClearReferenceObjects( const int theTag = 0 ); + +protected: + + Handle(TDataStd_ReferenceList) getReferenceList( const int theTag, + const bool theIsCreate ) const; + protected: /// Array of pointers to the properties of this object; index in this array is returned by \a AddProperty. TDF_Label myLab; ///< label of this object }; -typedef NCollection_Sequence HYDROData_SequenceOfObjects; - ///! Is Equal for HYDROData_Object mapping HYDRODATA_EXPORT bool IsEqual(const Handle_HYDROData_Object& theObj1, const Handle_HYDROData_Object& theObj2); diff --git a/src/HYDROData/HYDROData_Polyline.cxx b/src/HYDROData/HYDROData_Polyline.cxx index 64ae5f20..fb723700 100755 --- a/src/HYDROData/HYDROData_Polyline.cxx +++ b/src/HYDROData/HYDROData_Polyline.cxx @@ -262,6 +262,28 @@ HYDROData_Polyline::PolylineData HYDROData_Polyline::getPolylineData() const return aRes; } +/** + * Returns true if polyline is closed + */ +bool HYDROData_Polyline::isClosed() const +{ + int aDim = getDimension(); + PolylineData aPolylineData = getPolylineData(); + + if ( aDim == 0 || aPolylineData.isEmpty() ) + return false; + + PolylineData::const_iterator anIt = aPolylineData.constBegin(); + for ( ; anIt != aPolylineData.constEnd(); ++anIt ) + { + const PolylineSection& aSection = *anIt; + if ( !aSection.myIsClosed ) + return false; + } + + return true; +} + /** * Remove all polyline attributes except dimension. */ @@ -286,7 +308,7 @@ void HYDROData_Polyline::removeAll() * is ignored section type. * \return polyline painter path. */ -QPainterPath HYDROData_Polyline::painterPath() +QPainterPath HYDROData_Polyline::painterPath() const { QPainterPath aPath; int aDim = getDimension(); diff --git a/src/HYDROData/HYDROData_Polyline.h b/src/HYDROData/HYDROData_Polyline.h index cd7928c8..3906ac53 100755 --- a/src/HYDROData/HYDROData_Polyline.h +++ b/src/HYDROData/HYDROData_Polyline.h @@ -79,6 +79,11 @@ public: */ HYDRODATA_EXPORT PolylineData getPolylineData() const; + /** + * Returns true if polyline is closed + */ + HYDRODATA_EXPORT bool isClosed() const; + /** * Return polyline dimension * \return polyline dimension (2 or 3) @@ -100,7 +105,7 @@ public: /** * Returns the painter path. The painter path is construct by lines */ - HYDRODATA_EXPORT QPainterPath painterPath(); + HYDRODATA_EXPORT QPainterPath painterPath() const; protected: diff --git a/src/HYDROData/HYDROData_Zone.cxx b/src/HYDROData/HYDROData_Zone.cxx new file mode 100644 index 00000000..f8723453 --- /dev/null +++ b/src/HYDROData/HYDROData_Zone.cxx @@ -0,0 +1,126 @@ + +#include "HYDROData_Zone.h" + +#include "HYDROData_Bathymetry.h" +#include "HYDROData_Document.h" +#include "HYDROData_Polyline.h" +#include "HYDROData_Iterator.h" + +#include + +#include +#include + +#define PYTHON_POLYLINE_ID "KIND_ZONE" + +IMPLEMENT_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Object) +IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Object) + +HYDROData_Zone::HYDROData_Zone() +{ +} + +HYDROData_Zone::~HYDROData_Zone() +{ +} + +QStringList HYDROData_Zone::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const +{ + QStringList aResList; + + Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this ); + if ( aDocument.IsNull() ) + return aResList; + + return aResList; +} + +void HYDROData_Zone::SetColor( const QColor& theColor ) +{ + Handle(TDataStd_IntegerArray) aColorArray; + if ( !myLab.FindChild( DataTag_Color ).FindAttribute( TDataStd_IntegerArray::GetID(), aColorArray ) ) + aColorArray = TDataStd_IntegerArray::Set( myLab.FindChild( DataTag_Color ), 1, 4 ); + + aColorArray->SetValue( 1, theColor.red() ); + aColorArray->SetValue( 2, theColor.green() ); + aColorArray->SetValue( 3, theColor.blue() ); + aColorArray->SetValue( 4, theColor.alpha() ); +} + +QColor HYDROData_Zone::GetColor() const +{ + QColor aResColor( Qt::green ); + + Handle(TDataStd_IntegerArray) aColorArray; + if ( myLab.FindChild( DataTag_Color ).FindAttribute( TDataStd_IntegerArray::GetID(), aColorArray ) ) + { + aResColor.setRed( aColorArray->Value( 1 ) ); + aResColor.setGreen( aColorArray->Value( 2 ) ); + aResColor.setBlue( aColorArray->Value( 3 ) ); + aResColor.setAlpha( aColorArray->Value( 4 ) ); + } + + return aResColor; +} + +void HYDROData_Zone::SetPolyline( const Handle(HYDROData_Polyline)& thePolyline ) +{ + SetReferenceObject( thePolyline, DataTag_Polyline ); +} + +Handle(HYDROData_Polyline) HYDROData_Zone::GetPolyline() const +{ + return Handle(HYDROData_Polyline)::DownCast( + GetReferenceObject( DataTag_Polyline ) ); +} + +void HYDROData_Zone::RemovePolyline() +{ + ClearReferenceObjects( DataTag_Polyline ); +} + +int HYDROData_Zone::NbBathymetries() const +{ + return NbReferenceObjects( DataTag_Bathymetry ); +} + +void HYDROData_Zone::AddBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry ) +{ + AddReferenceObject( theBathymetry, DataTag_Bathymetry ); +} + +void HYDROData_Zone::SetBathymetry( const int theIndex, + const Handle(HYDROData_Bathymetry)& theBathymetry ) +{ + SetReferenceObject( theBathymetry, DataTag_Bathymetry, theIndex ); +} + +Handle(HYDROData_Bathymetry) HYDROData_Zone::GetBathymetry( const int theIndex ) const +{ + return Handle(HYDROData_Bathymetry)::DownCast( + GetReferenceObject( DataTag_Bathymetry, theIndex ) ); +} + +HYDROData_SequenceOfObjects HYDROData_Zone::GetBathymetries() const +{ + return GetReferenceObjects( DataTag_Bathymetry ); +} + +void HYDROData_Zone::RemoveBathymetries() +{ + ClearReferenceObjects( DataTag_Bathymetry ); +} + +QPainterPath HYDROData_Zone::GetPainterPath() const +{ + QPainterPath aPath; + + Handle(HYDROData_Polyline) aPolyline = GetPolyline(); + if ( !aPolyline.IsNull() ) + { + aPath = aPolyline->painterPath(); + } + + return aPath; +} + diff --git a/src/HYDROData/HYDROData_Zone.h b/src/HYDROData/HYDROData_Zone.h new file mode 100644 index 00000000..e9ad3ba9 --- /dev/null +++ b/src/HYDROData/HYDROData_Zone.h @@ -0,0 +1,135 @@ + +#ifndef HYDROData_Zone_HeaderFile +#define HYDROData_Zone_HeaderFile + +#include + +#include +#include +#include + +class Handle(HYDROData_Bathymetry); +class Handle(HYDROData_Polyline); + +DEFINE_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Object) + + +/**\class HYDROData_Zone + * \brief Class that stores/retreives information about the 2d face. + */ +class HYDROData_Zone : public HYDROData_Object +{ + +protected: + /** + * Enumeration of tags corresponding to the persistent object parameters. + */ + enum DataTag + { + DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve + DataTag_Bathymetry, ///< reference bathymetries + DataTag_Polyline, ///< reference polyline + DataTag_Color ///< color of zone + }; + +public: + DEFINE_STANDARD_RTTI(HYDROData_Zone); + + /** + * Returns the kind of this object. Must be redefined in all objects of known type. + */ + HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_ZONE;} + + /** + * Dump object to Python script representation. + */ + HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const; + + + /** + * Sets color for zone. + */ + HYDRODATA_EXPORT virtual void SetColor( const QColor& theColor ); + + /** + * Returns color of zone. + */ + HYDRODATA_EXPORT virtual QColor GetColor() const; + + + /** + * Sets reference polyline object for zone. + */ + HYDRODATA_EXPORT virtual void SetPolyline( const Handle(HYDROData_Polyline)& thePolyline ); + + /** + * Returns reference polyline object of zone. + */ + HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline) GetPolyline() const; + + /** + * Remove reference polyline object of zone. + */ + HYDRODATA_EXPORT virtual void RemovePolyline(); + + + /** + * Returns number of bathymetry objects for zone. + */ + HYDRODATA_EXPORT virtual int NbBathymetries() const; + + /** + * Add reference bathymetry object for zone. + */ + HYDRODATA_EXPORT virtual void AddBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry ); + + /** + * Change reference bathymetry object with given index for zone. + */ + HYDRODATA_EXPORT virtual void SetBathymetry( const int theIndex, + const Handle(HYDROData_Bathymetry)& theBathymetry ); + + /** + * Returns reference bathymetry object of zone by it index. + */ + HYDRODATA_EXPORT virtual Handle(HYDROData_Bathymetry) GetBathymetry( const int theIndex ) const; + + /** + * Returns list of all reference bathymetry objects of zone. + */ + HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetBathymetries() const; + + /** + * Clear list of bathymetry objects of zone. + */ + HYDRODATA_EXPORT virtual void RemoveBathymetries(); + + /** + * Returns data of object wrapped to QVariant. + * Reimplemented to wrap and return saved 2d polyline. + */ + //HYDRODATA_EXPORT virtual QVariant GetDataVariant(); + + /** + * Returns the painter path. The painter path is construct by polyline + */ + HYDRODATA_EXPORT QPainterPath GetPainterPath() const; + + +protected: + + friend class HYDROData_Iterator; + + /** + * Creates new object in the internal data structure. Use higher level objects + * to create objects with real content. + */ + HYDROData_Zone(); + + /** + * Destructs properties of the object and object itself, removes it from the document. + */ + ~HYDROData_Zone(); +}; + +#endif