aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_CHANNEL );
aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_DIGUE );
aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_OBSTACLE );
+ aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_LAND_COVER_MAP );
aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_CALCULATION );
// Dump code to close python fuction
theType = "";
return TopoDS_Face();
}
+
+/**
+ Dump to Python
+ @param theTreatedObjects the map of treated objects
+*/
+QStringList HYDROData_LandCoverMap::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+{
+ QStringList aResList = dumpObjectCreation( theTreatedObjects );
+ QString aName = GetObjPyName();
+
+ //Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis();
+ //setPythonReferenceObject( theTreatedObjects, aResList, aHydAxis, "SetHydraulicAxis" );
+
+ //HYDROData_SequenceOfObjects aSeqOfProfiles = GetProfiles();
+ //for ( int i = 1, aNb = aSeqOfProfiles.Size(); i <= aNb; ++i )
+ //{
+ //const Handle(HYDROData_Entity) aProfile = aSeqOfProfiles.Value( i );
+ //setPythonReferenceObject( theTreatedObjects, aResList, aProfile, "AddProfile" );
+ //}
+
+ //TODO
+
+ return aResList;
+}
HYDRODATA_EXPORT TopoDS_Shape GetShape() const;
+ HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+
protected:
void SetShape( const TopoDS_Shape& );
#include <QString>
#include <QColor>
#include <QMap>
+#include <QDir>
#include <BRepTools.hxx>
#include <BRep_Builder.hxx>
aDoc->Close();
}
+void test_HYDROData_LandCoverMap::test_dump_python()
+{
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+ Handle(HYDROData_LandCoverMap) aMap =
+ Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+ aMap->SetName( "test_LCM" );
+
+ CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
+
+ TopoDS_Face aLC1 = Face( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+
+ CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) );
+
+ TopoDS_Face aLC2 = Face( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
+ 44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
+ 128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
+ 31 << 114 );
+ CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) );
+
+ TopoDS_Face aLC3 = Face( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
+ 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
+ CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) );
+
+ QString aTmpPath = QDir::tempPath() + "/lc_dump.py";
+ CPPUNIT_ASSERT_EQUAL( true, aDoc->DumpToPython( aTmpPath, false ) );
+
+ //TODO: compare files
+}
CPPUNIT_TEST( test_import_dbf );
CPPUNIT_TEST( test_land_cover_prs_by_types );
CPPUNIT_TEST( test_land_cover_prs_by_coeff );
+ CPPUNIT_TEST( test_dump_python );
CPPUNIT_TEST_SUITE_END();
public:
void test_import_dbf();
void test_land_cover_prs_by_types();
void test_land_cover_prs_by_coeff();
+ void test_dump_python();
};
CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_LandCoverMap );