From: asl Date: Mon, 19 Oct 2015 12:18:11 +0000 (+0300) Subject: methods to get index and change Strickler type via the iterator X-Git-Tag: v1.5~90 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=601ba929ac67172be1c1d9639c515c61e97010e8;p=modules%2Fhydro.git methods to get index and change Strickler type via the iterator --- diff --git a/src/HYDROData/HYDROData_LandCoverMap.cxx b/src/HYDROData/HYDROData_LandCoverMap.cxx index 2e7ffffa..575f94d5 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.cxx +++ b/src/HYDROData/HYDROData_LandCoverMap.cxx @@ -90,8 +90,9 @@ void HYDROData_LandCoverMap::Iterator::Init( const HYDROData_LandCoverMap& theMa myIterator = 0; else myIterator = new TopoDS_Iterator( aShape ); - myIndex = 0; + theMap.myLab.FindChild( DataTag_Types ).FindAttribute( TDataStd_ExtStringArray::GetID(), myArray ); + myIndex = myArray->Lower(); } /** @@ -102,6 +103,18 @@ HYDROData_LandCoverMap::Iterator::~Iterator() delete myIterator; } +/** + Return the current 0-based index of the iterator + @return the current index +*/ +int HYDROData_LandCoverMap::Iterator::Index() const +{ + if( myArray.IsNull() ) + return -1; + else + return myIndex - myArray->Lower(); +} + /** Return if the iterator has more elements @return if the iterator has more elements @@ -147,6 +160,18 @@ QString HYDROData_LandCoverMap::Iterator::StricklerType() const return HYDROData_Tool::toQString( myArray->Value( myIndex ) ); } +/** + Set the Strickler type for the current land cover + @param theType the Strickler type +*/ +void HYDROData_LandCoverMap::Iterator::SetStricklerType( const QString& theType ) +{ + if( myArray.IsNull() || myIndex < myArray->Lower() || myIndex > myArray->Upper() ) + return; + else + myArray->SetValue( myIndex, HYDROData_Tool::toExtString( theType ) ); +} + /** Constructor */ diff --git a/src/HYDROData/HYDROData_LandCoverMap.h b/src/HYDROData/HYDROData_LandCoverMap.h index fad2aceb..ce8fd88c 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.h +++ b/src/HYDROData/HYDROData_LandCoverMap.h @@ -57,8 +57,10 @@ public: bool More() const; void Next(); + int Index() const; TopoDS_Face Face() const; QString StricklerType() const; + void SetStricklerType( const QString& ); private: TopoDS_Iterator* myIterator;