#include "HYDROData_Zone.h"
-#include "HYDROData_Bathymetry.h"
+#include "HYDROData_ArtificialObject.h"
+#include "HYDROData_IAltitudeObject.h"
#include "HYDROData_Document.h"
-#include "HYDROData_Polyline.h"
-#include "HYDROData_Iterator.h"
+#include "HYDROData_NaturalObject.h"
-#include <TDataStd_IntegerArray.hxx>
+#include <TNaming_Builder.hxx>
+#include <TNaming_NamedShape.hxx>
+
+#include <TopoDS_Shape.hxx>
-#include <QColor>
#include <QStringList>
-#define PYTHON_ZONE_ID "KIND_ZONE"
+#include <TDataStd_Integer.hxx>
+
+IMPLEMENT_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Entity)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Entity)
-IMPLEMENT_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Domain)
-IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Domain)
HYDROData_Zone::HYDROData_Zone()
+: HYDROData_Entity()
{
+ myInterpolator = NULL;
}
HYDROData_Zone::~HYDROData_Zone()
{
}
-QStringList HYDROData_Zone::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+bool HYDROData_Zone::CanBeUpdated() const
+{
+ return false;
+}
+
+bool HYDROData_Zone::CanRemove()
{
- QStringList aResList = HYDROData_Domain::DumpToPython( theTreatedObjects );
- if ( aResList.isEmpty() )
- return aResList;
+ return false;
+}
+
+HYDROData_SequenceOfObjects HYDROData_Zone::GetAllReferenceObjects() const
+{
+ HYDROData_SequenceOfObjects aResSeq = HYDROData_Entity::GetAllReferenceObjects();
+
+ HYDROData_SequenceOfObjects aSeqOfGeomObjects = GetGeometryObjects();
+ aResSeq.Append( aSeqOfGeomObjects );
+
+ return aResSeq;
+}
- aResList << QString( "" );
+void HYDROData_Zone::SetShape( const TopoDS_Shape& theShape )
+{
+ TNaming_Builder aBuilder( myLab.FindChild( DataTag_Shape ) );
+ aBuilder.Generated( theShape );
+}
- Handle(HYDROData_Polyline) aRefPolyline = GetPolyline();
- setPythonReferenceObject( theTreatedObjects, aResList, aRefPolyline, "SetPolyline" );
+TopoDS_Shape HYDROData_Zone::GetShape() const
+{
+ TDF_Label aLabel = myLab.FindChild( DataTag_Shape, false );
+ if ( !aLabel.IsNull() )
+ {
+ Handle(TNaming_NamedShape) aNamedShape;
+ if( aLabel.FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
+ return aNamedShape->Get();
+ }
- return aResList;
+ return TopoDS_Shape();
}
-void HYDROData_Zone::SetPolyline( const Handle(HYDROData_Polyline)& thePolyline )
+bool HYDROData_Zone::IsMergingNeed() const
{
- SetReferenceObject( thePolyline, DataTag_Polyline );
+ Handle(HYDROData_IAltitudeObject) aRefAltitude;
+
+ HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
+ HYDROData_SequenceOfObjects::Iterator aGeomObjsIter( aGeomObjects );
+ for ( ; aGeomObjsIter.More(); aGeomObjsIter.Next() )
+ {
+ Handle(HYDROData_Object) aRefGeomObj =
+ Handle(HYDROData_Object)::DownCast( aGeomObjsIter.Value() );
+ if ( aRefGeomObj.IsNull() )
+ continue;
+
+ Handle(HYDROData_IAltitudeObject) anObjAltitude = aRefGeomObj->GetAltitudeObject();
+ if ( anObjAltitude.IsNull() )
+ continue;
+
+ if ( aRefAltitude.IsNull() )
+ {
+ aRefAltitude = anObjAltitude;
+ continue;
+ }
+
+ if ( !IsEqual( aRefAltitude, anObjAltitude ) )
+ return true;
+ }
+
+ return false;
}
-Handle(HYDROData_Polyline) HYDROData_Zone::GetPolyline() const
+void HYDROData_Zone::SetInterpolator( HYDROData_IInterpolator* theInter )
{
- return Handle(HYDROData_Polyline)::DownCast(
- GetReferenceObject( DataTag_Polyline ) );
+ myInterpolator = theInter;
}
-void HYDROData_Zone::RemovePolyline()
+HYDROData_IInterpolator* HYDROData_Zone::GetInterpolator() const
{
- ClearReferenceObjects( DataTag_Polyline );
+ return myInterpolator;
}
-QPainterPath HYDROData_Zone::GetPainterPath() const
+void HYDROData_Zone::SetMergeType( const MergeAltitudesType& theType )
{
- QPainterPath aPath;
+ TDataStd_Integer::Set( myLab.FindChild( DataTag_MergeType ), (int)theType );
+}
- Handle(HYDROData_Polyline) aPolyline = GetPolyline();
- if ( !aPolyline.IsNull() )
+HYDROData_Zone::MergeAltitudesType HYDROData_Zone::GetMergeType() const
+{
+ MergeAltitudesType aMergeType = Merge_UNKNOWN;
+
+ TDF_Label aLabel = myLab.FindChild( DataTag_MergeType, false );
+ if ( !aLabel.IsNull() )
{
- aPath = aPolyline->painterPath();
+ Handle(TDataStd_Integer) anInt;
+ if ( aLabel.FindAttribute( TDataStd_Integer::GetID(), anInt ) )
+ aMergeType = (MergeAltitudesType)anInt->Get();
}
- return aPath;
+ return aMergeType;
+}
+
+void HYDROData_Zone::SetMergeAltitude( const Handle(HYDROData_IAltitudeObject)& theAltitude )
+{
+ SetReferenceObject( theAltitude, DataTag_MergeAltitude );
+}
+
+Handle(HYDROData_IAltitudeObject) HYDROData_Zone::GetMergeAltitude() const
+{
+ return Handle(HYDROData_IAltitudeObject)::DownCast(
+ GetReferenceObject( DataTag_MergeAltitude ) );
+}
+
+void HYDROData_Zone::RemoveMergeAltitude()
+{
+ ClearReferenceObjects( DataTag_MergeAltitude );
+}
+
+bool HYDROData_Zone::AddGeometryObject( const Handle(HYDROData_Object)& theObject )
+{
+ if ( theObject.IsNull() )
+ return false;
+
+ if ( !theObject->IsKind( STANDARD_TYPE(HYDROData_ArtificialObject) ) &&
+ !theObject->IsKind( STANDARD_TYPE(HYDROData_NaturalObject) ) )
+ return false; // Wrong type of object
+
+ if ( HasReference( theObject, DataTag_GeometryObject ) )
+ return false; // Object is already in reference list
+
+ AddReferenceObject( theObject, DataTag_GeometryObject );
+
+ return true;
+}
+
+HYDROData_SequenceOfObjects HYDROData_Zone::GetGeometryObjects() const
+{
+ return GetReferenceObjects( DataTag_GeometryObject );
}
-QString HYDROData_Zone::getPythonKindId() const
+void HYDROData_Zone::RemoveGeometryObjects()
{
- return QString( PYTHON_ZONE_ID );
+ ClearReferenceObjects( DataTag_GeometryObject );
}