Init( theMap );
}
+HYDROData_LandCoverMap::Iterator::Iterator( const Handle( HYDROData_LandCoverMap )& theMap )
+{
+ if( theMap.IsNull() )
+ {
+ myIterator = 0;
+ myIndex = -1;
+ }
+ else
+ Init( *theMap );
+}
+
/**
Initialize the iterator
@param theMap the land cover map to iterate through
void HYDROData_LandCoverMap::Iterator::Next()
{
if( myIterator )
+ {
myIterator->Next();
+ myIndex++;
+ }
}
/**
HYDROData_MapOfFaceToStricklerType::Iterator aNFIt( theMap );
for( int i=0; aNFIt.More(); aNFIt.Next(), i++ )
{
- aCompoundBuilder.Add( aCompound, aNFIt.Key() );
- aTypes->SetValue( i, HYDROData_Tool::toExtString( aNFIt.Value() ) );
+ TopoDS_Face aFace = aNFIt.Key();
+ QString aType = aNFIt.Value();
+ aCompoundBuilder.Add( aCompound, aFace );
+ aTypes->SetValue( i, HYDROData_Tool::toExtString( aType ) );
}
SetShape( aCompound );
#include <HYDROData_Document.h>
#include <HYDROData_LandCoverMap.h>
#include <HYDROData_PolylineXY.h>
+#include <HYDROData_Tool.h>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Face.hxx>
TestViewer::show( aMap->GetShape(), AIS_Shaded, true );
TestViewer::AssertEqual( "LandCoverMap_Add_2_Objects" );
- //TODO: check the types
+ HYDROData_LandCoverMap::Iterator anIt( aMap );
+ CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+ CPPUNIT_ASSERT_EQUAL( QString( "test1" ), anIt.StricklerType() );
+ anIt.Next();
+ CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+ CPPUNIT_ASSERT_EQUAL( QString( "test2" ), anIt.StricklerType() );
+ anIt.Next();
+ CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
aDoc->Close();
}
//TestViewer::show( aWire, QColor(), 0 );
TestViewer::AssertEqual( "LandCoverMap_Split_1" );
- //TODO: check the types
+ HYDROData_LandCoverMap::Iterator anIt( aMap );
+ CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+ CPPUNIT_ASSERT_EQUAL( QString( "test1" ), anIt.StricklerType() );
+ anIt.Next();
+ CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+ CPPUNIT_ASSERT_EQUAL( QString( "test1" ), anIt.StricklerType() );
+ anIt.Next();
+ CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
aDoc->Close();
}