X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_Iterator.cxx;h=f33065fab44a56230b684b79524d472d473a986d;hb=deed826b2d6c39ba2ed410108cdf54d64cded321;hp=04ad41dd899879777e00b31caa5b5433f8f47da3;hpb=84f8b4a57d3cdad820bc1333a5066699cd1c8ae3;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_Iterator.cxx b/src/HYDROData/HYDROData_Iterator.cxx index 04ad41dd..f33065fa 100644 --- a/src/HYDROData/HYDROData_Iterator.cxx +++ b/src/HYDROData/HYDROData_Iterator.cxx @@ -1,13 +1,23 @@ #include "HYDROData_Iterator.h" +#include "HYDROData_AltitudeObject.h" #include "HYDROData_Bathymetry.h" -#include "HYDROData_Calculation.h" +#include "HYDROData_CalculationCase.h" +#include "HYDROData_Channel.h" +#include "HYDROData_Confluence.h" +#include "HYDROData_Digue.h" #include "HYDROData_Image.h" #include "HYDROData_ImmersibleZone.h" +#include "HYDROData_Obstacle.h" #include "HYDROData_Polyline.h" +#include "HYDROData_PolylineXY.h" +#include "HYDROData_Profile.h" +#include "HYDROData_ProfileUZ.h" #include "HYDROData_VisualState.h" #include "HYDROData_Region.h" +#include "HYDROData_River.h" +#include "HYDROData_Stream.h" #include "HYDROData_Zone.h" #include @@ -22,9 +32,10 @@ static TDF_Label GetLabelByKind(TDF_Label theRoot, ObjectKind theKind) return theRoot.FindChild(theKind); } -HYDROData_Iterator::HYDROData_Iterator(Handle(HYDROData_Document) theDoc, ObjectKind theKind) - : myIter(GetLabelByKind(theDoc->LabelOfObjects(), theKind), - TDataStd_Name::GetID(), theKind == KIND_UNKNOWN) // iterate all sub-objects for unknown kind +HYDROData_Iterator::HYDROData_Iterator( const Handle(HYDROData_Document)& theDoc, + const ObjectKind theKind ) +: myIter( GetLabelByKind( theDoc->LabelOfObjects(), theKind ), + TDataStd_Name::GetID(), theKind == KIND_UNKNOWN ) // iterate all sub-objects for unknown kind { } @@ -71,8 +82,16 @@ Handle(HYDROData_Entity) HYDROData_Iterator::CreateObject( TDF_Label& the return Object( theNewLabel ); } -Handle(HYDROData_Entity) HYDROData_Iterator::Object( const TDF_Label theLabel ) +Handle(HYDROData_Entity) HYDROData_Iterator::Object( const TDF_Label& theLabel ) { + Handle(HYDROData_Entity) aResult; + + // If label has no name attribute it mean that this is not object or + // this object has been removed from document + Handle(TDataStd_Name) aNameAtt; + if ( !theLabel.FindAttribute( TDataStd_Name::GetID(), aNameAtt ) ) + return aResult; + ObjectKind aKind = KIND_UNKNOWN; // Retrieve the type of object from label @@ -83,7 +102,6 @@ Handle(HYDROData_Entity) HYDROData_Iterator::Object( const TDF_Label theLabel ) if ( aKind == KIND_UNKNOWN ) aKind = theLabel.Father().Tag(); // Try to get type from father label - Handle(HYDROData_Entity) aResult; switch( aKind ) { case KIND_IMAGE: @@ -95,11 +113,41 @@ Handle(HYDROData_Entity) HYDROData_Iterator::Object( const TDF_Label theLabel ) case KIND_BATHYMETRY: aResult = new HYDROData_Bathymetry(); break; + case KIND_ALTITUDE: + aResult = new HYDROData_AltitudeObject(); + break; case KIND_IMMERSIBLE_ZONE: aResult = new HYDROData_ImmersibleZone(); break; + case KIND_RIVER: + aResult = new HYDROData_River(); + break; + case KIND_STREAM: + aResult = new HYDROData_Stream(); + break; + case KIND_CONFLUENCE: + aResult = new HYDROData_Confluence(); + break; + case KIND_CHANNEL: + aResult = new HYDROData_Channel(); + break; + case KIND_OBSTACLE: + aResult = new HYDROData_Obstacle(); + break; + case KIND_DIGUE: + aResult = new HYDROData_Digue(); + break; + case KIND_PROFILE: + aResult = new HYDROData_Profile(); + break; + case KIND_PROFILEUZ: + aResult = new HYDROData_ProfileUZ(); + break; + case KIND_POLYLINEXY: + aResult = new HYDROData_PolylineXY(); + break; case KIND_CALCULATION: - aResult = new HYDROData_Calculation(); + aResult = new HYDROData_CalculationCase(); break; case KIND_REGION: aResult = new HYDROData_Region();