html
latex
documentation.log
+tests.cfg
//
#include <HYDROData_LandCoverMap.h>
+#include <HYDROData_PolylineXY.h>
#include <HYDROData_Tool.h>
#include <BOPAlgo_Builder.hxx>
@param theType the Strickler type for the new land cover
@return if the addition is successful
*/
-bool HYDROData_LandCoverMap::Add( const Handle( HYDROData_Polyline )& thePolyline, const QString& theType )
+bool HYDROData_LandCoverMap::Add( const Handle( HYDROData_PolylineXY )& thePolyline, const QString& theType )
{
//TODO
return false;
@param thePolyline the tool polyline to split the land cover map
@return if the removing is successful
*/
-bool HYDROData_LandCoverMap::Split( const Handle( HYDROData_Polyline )& thePolyline )
+bool HYDROData_LandCoverMap::Split( const Handle( HYDROData_PolylineXY )& thePolyline )
{
- //TODO
- return false;
+ if( thePolyline.IsNull() )
+ return false;
+
+ TopoDS_Shape aShape = thePolyline->GetShape();
+ return LocalPartition( aShape, "" );
}
/**
class TopoDS_Shape;
class TopoDS_Iterator;
class TopTools_ListOfShape;
-class Handle( HYDROData_Polyline );
+class Handle( HYDROData_PolylineXY );
class Handle( HYDROData_Object );
class HYDROData_MapOfFaceToStricklerType;
bool ExportTelemac( const QString& theFileName ) const;
bool Add( const Handle( HYDROData_Object )&, const QString& theType );
- bool Add( const Handle( HYDROData_Polyline )&, const QString& theType );
+ bool Add( const Handle( HYDROData_PolylineXY )&, const QString& theType );
bool Remove( const TopoDS_Face& );
- bool Split( const Handle( HYDROData_Polyline )& );
+ bool Split( const Handle( HYDROData_PolylineXY )& );
bool Merge( const TopTools_ListOfShape&, const QString& theType );
protected:
#include <test_HYDROData_LandCoverMap.h>
#include <HYDROData_Document.h>
#include <HYDROData_LandCoverMap.h>
+#include <HYDROData_PolylineXY.h>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Face.hxx>
#include <TestViewer.h>
#include <AIS_DisplayMode.hxx>
#include <QString>
+#include <QColor>
TopoDS_Edge Spline( const QList<double>& theXYList, bool isClosed = false )
{
return aFace;
}
-void test_HYDROData_LandCoverMap::test_local_partition()
+void test_HYDROData_LandCoverMap::test_add_2_objects()
{
Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
TestViewer::show( aMap->GetShape(), AIS_Shaded, true );
TestViewer::AssertEqual( "LandCoverMap_Add_2_Objects" );
+ //TODO: check the types
+
aDoc->Close();
}
+void test_HYDROData_LandCoverMap::test_split_by_polyline()
+{
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+ Handle(HYDROData_LandCoverMap) aMap =
+ Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+
+ CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
+
+ TopoDS_Face aLC = LandCover( QList<double>() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 );
+ CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC, "test1" ) );
+
+ Handle(HYDROData_PolylineXY) aPolyline =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+ TopoDS_Wire aWire = BRepBuilderAPI_MakeWire( Spline( QList<double>() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10 ) ).Wire();
+ aPolyline->SetShape( aWire );
+
+ CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) );
+
+ TestViewer::show( aMap->GetShape(), AIS_Shaded, true );
+ //TestViewer::show( aWire, QColor(), 0 );
+ TestViewer::AssertEqual( "LandCoverMap_Split_1" );
+
+ //TODO: check the types
+
+ aDoc->Close();
+}
class test_HYDROData_LandCoverMap : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE( test_HYDROData_LandCoverMap );
- CPPUNIT_TEST( test_local_partition );
+ CPPUNIT_TEST( test_add_2_objects );
+ CPPUNIT_TEST( test_split_by_polyline );
CPPUNIT_TEST_SUITE_END();
public:
- void test_local_partition();
+ void test_add_2_objects();
+ void test_split_by_polyline();
};
CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_LandCoverMap );