#include "HYDROData_Zone.h"
#include "HYDROData_ArtificialObject.h"
-#include "HYDROData_Bathymetry.h"
+#include "HYDROData_IAltitudeObject.h"
#include "HYDROData_Document.h"
#include "HYDROData_NaturalObject.h"
#include <TDataStd_Integer.hxx>
-#define PYTHON_ZONE_ID "KIND_ZONE"
-
IMPLEMENT_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Entity)
IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Entity)
HYDROData_Zone::HYDROData_Zone()
: HYDROData_Entity()
{
+ myInterpolator = NULL;
}
HYDROData_Zone::~HYDROData_Zone()
{
}
-QStringList HYDROData_Zone::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+bool HYDROData_Zone::CanBeUpdated() const
{
- QStringList aResList;
-
- Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
- if ( aDocument.IsNull() )
- return aResList;
-
- QString aDocName = aDocument->GetDocPyName();
- QString aZoneName = GetName();
+ return false;
+}
- aResList << QString( "%1 = %2.CreateObject( %3 );" )
- .arg( aZoneName ).arg( aDocName ).arg( PYTHON_ZONE_ID );
- aResList << QString( "%1.SetName( \"%2\" );" )
- .arg( aZoneName ).arg( aZoneName );
- aResList << QString( "" );
+bool HYDROData_Zone::CanRemove()
+{
+ return false;
+}
- 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() )
- setPythonReferenceObject( theTreatedObjects, aResList, aRefGeomObj, "AddGeometryObject" );
- }
+HYDROData_SequenceOfObjects HYDROData_Zone::GetAllReferenceObjects() const
+{
+ HYDROData_SequenceOfObjects aResSeq = HYDROData_Entity::GetAllReferenceObjects();
- // How can we get the shape? Mb Update() method to intersect the shapes of reference objects?
- // TODO: TopoDS_Shape aRefShape = GetShape();
+ HYDROData_SequenceOfObjects aSeqOfGeomObjects = GetGeometryObjects();
+ aResSeq.Append( aSeqOfGeomObjects );
- return aResList;
+ return aResSeq;
}
void HYDROData_Zone::SetShape( const TopoDS_Shape& theShape )
TopoDS_Shape HYDROData_Zone::GetShape() const
{
- Handle(TNaming_NamedShape) aNamedShape;
- if( myLab.FindChild( DataTag_Shape ).FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
- return aNamedShape->Get();
+ 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 TopoDS_Shape();
}
bool HYDROData_Zone::IsMergingNeed() const
{
- Handle(HYDROData_Bathymetry) aRefBathymetry;
+ Handle(HYDROData_IAltitudeObject) aRefAltitude;
HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
HYDROData_SequenceOfObjects::Iterator aGeomObjsIter( aGeomObjects );
if ( aRefGeomObj.IsNull() )
continue;
- Handle(HYDROData_Bathymetry) anObjBathymetry = aRefGeomObj->GetBathymetry();
- if ( anObjBathymetry.IsNull() )
+ Handle(HYDROData_IAltitudeObject) anObjAltitude = aRefGeomObj->GetAltitudeObject();
+ if ( anObjAltitude.IsNull() )
continue;
- if ( aRefBathymetry.IsNull() )
+ if ( aRefAltitude.IsNull() )
{
- aRefBathymetry = anObjBathymetry;
+ aRefAltitude = anObjAltitude;
continue;
}
- if ( !IsEqual( aRefBathymetry, anObjBathymetry ) )
+ if ( !IsEqual( aRefAltitude, anObjAltitude ) )
return true;
}
return false;
}
-void HYDROData_Zone::SetMergeType( const MergeBathymetriesType& theType )
+void HYDROData_Zone::SetInterpolator( HYDROData_IInterpolator* theInter )
+{
+ myInterpolator = theInter;
+}
+
+HYDROData_IInterpolator* HYDROData_Zone::GetInterpolator() const
+{
+ return myInterpolator;
+}
+
+void HYDROData_Zone::SetMergeType( const MergeAltitudesType& theType )
{
- Handle(TDataStd_Integer) anInt;
- if ( !myLab.FindChild( DataTag_MergeType ).FindAttribute( TDataStd_Integer::GetID(), anInt ) )
- anInt = TDataStd_Integer::Set( myLab, 0 );
- anInt->Set( (int)theType );
+ TDataStd_Integer::Set( myLab.FindChild( DataTag_MergeType ), (int)theType );
}
-HYDROData_Zone::MergeBathymetriesType HYDROData_Zone::GetMergeType() const
+HYDROData_Zone::MergeAltitudesType HYDROData_Zone::GetMergeType() const
{
- MergeBathymetriesType aMergeType = Merge_UNKNOWN;
+ MergeAltitudesType aMergeType = Merge_UNKNOWN;
- Handle(TDataStd_Integer) anInt;
- if ( myLab.FindChild( DataTag_MergeType ).FindAttribute( TDataStd_Integer::GetID(), anInt ) )
- aMergeType = (MergeBathymetriesType)anInt->Get();
+ TDF_Label aLabel = myLab.FindChild( DataTag_MergeType, false );
+ if ( !aLabel.IsNull() )
+ {
+ Handle(TDataStd_Integer) anInt;
+ if ( aLabel.FindAttribute( TDataStd_Integer::GetID(), anInt ) )
+ aMergeType = (MergeAltitudesType)anInt->Get();
+ }
return aMergeType;
}
-void HYDROData_Zone::SetMergeBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry )
+void HYDROData_Zone::SetMergeAltitude( const Handle(HYDROData_IAltitudeObject)& theAltitude )
{
- SetReferenceObject( theBathymetry, DataTag_Bathymetry );
+ SetReferenceObject( theAltitude, DataTag_MergeAltitude );
}
-Handle(HYDROData_Bathymetry) HYDROData_Zone::GetMergeBathymetry() const
+Handle(HYDROData_IAltitudeObject) HYDROData_Zone::GetMergeAltitude() const
{
- return Handle(HYDROData_Bathymetry)::DownCast(
- GetReferenceObject( DataTag_Bathymetry ) );
+ return Handle(HYDROData_IAltitudeObject)::DownCast(
+ GetReferenceObject( DataTag_MergeAltitude ) );
}
-void HYDROData_Zone::RemoveMergeBathymetry()
+void HYDROData_Zone::RemoveMergeAltitude()
{
- ClearReferenceObjects( DataTag_Bathymetry );
+ ClearReferenceObjects( DataTag_MergeAltitude );
}
bool HYDROData_Zone::AddGeometryObject( const Handle(HYDROData_Object)& theObject )
return false; // Object is already in reference list
AddReferenceObject( theObject, DataTag_GeometryObject );
+
return true;
}