]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
methods to get index and change Strickler type via the iterator
authorasl <asl@opencascade.com>
Mon, 19 Oct 2015 12:18:11 +0000 (15:18 +0300)
committerasl <asl@opencascade.com>
Mon, 19 Oct 2015 12:18:11 +0000 (15:18 +0300)
src/HYDROData/HYDROData_LandCoverMap.cxx
src/HYDROData/HYDROData_LandCoverMap.h

index 2e7ffffa29416343c07d4f4cfec44b7a1e76567d..575f94d5fcf12a9203a74047cbe6b6ed738939e5 100644 (file)
@@ -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
 */
index fad2aceb833121e96279120e91f2c4017aa69d20..ce8fd88c9648ee01548b97030a6d6a1022ff02e2 100644 (file)
@@ -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;