#include <TopTools_ListOfShape.hxx>
#include <AIS_DisplayMode.hxx>
#include <Aspect_ColorScale.hxx>
+#include <BRepMesh_IncrementalMesh.hxx>
#include <QString>
#include <QColor>
#include <QMap>
aDoc->Close();
}
+void test_HYDROData_LandCoverMap::test_merge_refs_691()
+{
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+ Handle(HYDROData_PolylineXY) Polyline_4 =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+ Polyline_4->SetName( "test_Polyline_4" );
+ Polyline_4->AddSection( "Section_1", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+ Polyline_4->AddPoint( 0, gp_XY( -242.741935, -16.129032 ) );
+ Polyline_4->AddPoint( 0, gp_XY( -339.516129, -95.161290 ) );
+ Polyline_4->AddPoint( 0, gp_XY( -204.032258, -167.740000 ) );
+ Polyline_4->AddPoint( 0, gp_XY( -86.290000, -158.060000 ) );
+ Polyline_4->AddPoint( 0, gp_XY( -83.064516, -37.096774 ) );
+ Polyline_4->AddPoint( 0, gp_XY( -116.935484, 17.741935 ) );
+ Polyline_4->AddSection( "Section_2", HYDROData_PolylineXY::SECTION_POLYLINE, true );
+ Polyline_4->AddPoint( 1, gp_XY( -239.516129, -295.161290 ) );
+ Polyline_4->AddPoint( 1, gp_XY( -204.030000, -167.740000 ) );
+ Polyline_4->AddPoint( 1, gp_XY( -86.290000, -158.060000 ) );
+ Polyline_4->AddPoint( 1, gp_XY( -2.419355, -288.709677 ) );
+ Polyline_4->AddPoint( 1, gp_XY( -165.322581, -351.612903 ) );
+ Polyline_4->Update();
+
+ Handle(HYDROData_LandCoverMap) aMap =
+ Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+
+ CPPUNIT_ASSERT_EQUAL( true, aMap->Add( Polyline_4, "test" ) );
+
+ TopTools_ListOfShape aList;
+ HYDROData_LandCoverMap::Explorer anIt( aMap );
+ CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+ CPPUNIT_ASSERT_EQUAL( QString( "test" ), anIt.StricklerType() );
+ aList.Append( anIt.Face() );
+ anIt.Next();
+ CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+ CPPUNIT_ASSERT_EQUAL( QString( "test" ), anIt.StricklerType() );
+ aList.Append( anIt.Face() );
+ anIt.Next();
+ CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
+
+ BRepCheck_Analyzer aCheck1( aMap->GetShape() );
+ CPPUNIT_ASSERT_EQUAL( true, (bool)aCheck1.IsValid() );
+
+ CPPUNIT_ASSERT_EQUAL( true, aMap->Merge( aList, "test" ) );
+
+ BRepCheck_Analyzer aCheck2( aMap->GetShape() );
+ CPPUNIT_ASSERT_EQUAL( true, (bool)aCheck2.IsValid() );
+
+ // we try construct the triangulation to check that it is correct
+ BRepMesh_IncrementalMesh anIncMesh( aMap->GetShape(), 0.01 );
+ CPPUNIT_ASSERT_EQUAL( true, (bool)anIncMesh.IsDone() );
+ BRepCheck_Analyzer aCheck3( aMap->GetShape() );
+ CPPUNIT_ASSERT_EQUAL( true, (bool)aCheck3.IsValid() );
+
+ Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap );
+ TestViewer::show( aPrs, AIS_Shaded, 0, true, "LandCoverMap_Merge_2" );
+ CPPUNIT_ASSERT_IMAGES
+
+ aDoc->Close();
+}
+
void test_HYDROData_LandCoverMap::test_remove()
{
Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
QList<int> Inds = QList<int>() << 1 << 2 << 3;
aMap->ImportDBF(aFileName, "TESTFIELD1", aDBFV, aST, Inds);
HYDROData_LandCoverMap::Explorer anIt( aMap );
-
CPPUNIT_ASSERT_EQUAL( QString( "forest" ), anIt.StricklerType() );
anIt.Next();
CPPUNIT_ASSERT_EQUAL( QString( "road" ), anIt.StricklerType() );