case KIND_OBSTACLE_ALTITUDE: return "KIND_OBSTACLE_ALTITUDE";
case KIND_STRICKLER_TABLE: return "KIND_STRICKLER_TABLE";
case KIND_LAND_COVER: return "KIND_LAND_COVER";
+ case KIND_LAND_COVER_MAP: return "KIND_LAND_COVER_MAP";
default: return "KIND_UNKNOWN"; ///! Unrecognized object
}
}
const ObjectKind KIND_OBSTACLE_ALTITUDE = 25;
const ObjectKind KIND_STRICKLER_TABLE = 26;
const ObjectKind KIND_LAND_COVER = 27;
+const ObjectKind KIND_LAND_COVER_MAP = 28;
const ObjectKind KIND_LAST = KIND_LAND_COVER;
DEFINE_STANDARD_HANDLE(HYDROData_Entity, MMgt_TShared)
#include "HYDROData_Zone.h"
#include "HYDROData_StricklerTable.h"
#include "HYDROData_LandCover.h"
+#include "HYDROData_LandCoverMap.h"
#include <TDataStd_Name.hxx>
#include <TDataStd_NamedData.hxx>
case KIND_OBSTACLE_ALTITUDE: aResult = new HYDROData_ObstacleAltitude(); break;
case KIND_STRICKLER_TABLE: aResult = new HYDROData_StricklerTable(); break;
case KIND_LAND_COVER: aResult = new HYDROData_LandCover(); break;
+ case KIND_LAND_COVER_MAP: aResult = new HYDROData_LandCoverMap(); break;
default: break;
}
{
}
+/**
+ Get object's kind
+ @return object's kind
+*/
+const ObjectKind HYDROData_LandCoverMap::GetKind() const
+{
+ return KIND_LAND_COVER_MAP;
+}
+
/**
Import the land cover map from QGIS
@param theFileName the name of file
DataTag_Types,
};
+public:
class Iterator
{
public:
HYDROData_LandCoverMap();
~HYDROData_LandCoverMap();
+ virtual const ObjectKind GetKind() const;
+
bool ImportQGIS( const QString& theFileName );
bool ExportQGIS( const QString& theFileName ) const;
bool ExportTelemac( const QString& theFileName ) const;
test_HYDROData_Entity.h
test_HYDROData_Image.h
test_HYDROData_Iterator.h
+ test_HYDROData_LandCoverMap.h
test_HYDROData_OperationsFactory.h
test_HYDROData_PolylineXY.h
test_HYDROData_Profile.h
test_HYDROData_Entity.cxx
test_HYDROData_Image.cxx
test_HYDROData_Iterator.cxx
+ test_HYDROData_LandCoverMap.cxx
test_HYDROData_Main.cxx
test_HYDROData_OperationsFactory.cxx
test_HYDROData_PolylineXY.cxx
test_HYDROData_StricklerTable.cxx
test_HYDROGUI_ListModel.cxx
- ${EXTERNAL_FILES}
-
TestViewer.cxx
)
${CMAKE_CURRENT_SOURCE_DIR}/../shapelib
)
-add_executable( HYDROData_tests ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+source_group( "External files" FILES ${EXTERNAL_FILES} )
+
+add_executable( HYDROData_tests ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${EXTERNAL_FILES} )
target_link_libraries( HYDROData_tests ${GUI_LIBRARIES} ${CAS_LIBRARIES} ${QT_LIBRARIES} ${CPPUNIT_LIBRARIES} shapelib )
IF( ${WIN32} )
--- /dev/null
+// Copyright (C) 2014-2015 EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <test_HYDROData_LandCoverMap.h>
+#include <HYDROData_Document.h>
+#include <HYDROData_LandCoverMap.h>
+#include <TopoDS_Edge.hxx>
+#include <TColgp_HArray1OfPnt.hxx>
+#include <GeomAPI_Interpolate.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <stdarg.h>
+
+TopoDS_Edge Spline( bool isClosed, double x, double y, ... )
+{
+ va_list anArgs;
+ va_start( anArgs, y );
+ QList<gp_Pnt> aPointsList;
+ while( true )
+ {
+ double x = va_arg( anArgs, double );
+ if( x <= 0 )
+ break;
+ double y = va_arg( anArgs, double );
+ gp_Pnt aPnt( x, y, 0 );
+ aPointsList.append( aPnt );
+ }
+ va_end( anArgs );
+
+ int n = aPointsList.size();
+ Handle(TColgp_HArray1OfPnt) aPointsArray = new TColgp_HArray1OfPnt( 1, n );
+ for( int i=1; i<=n; i++ )
+ aPointsArray->SetValue( i, aPointsList[i-1] );
+
+ GeomAPI_Interpolate anInterpolator( aPointsArray, isClosed, 1E-3 );
+ anInterpolator.Perform();
+ bool aResult = anInterpolator.IsDone() == Standard_True;
+ if( aResult )
+ {
+ Handle( Geom_BSplineCurve ) aCurve = anInterpolator.Curve();
+ return BRepBuilderAPI_MakeEdge( aCurve ).Edge();
+ }
+ else
+ return TopoDS_Edge();
+}
+
+void test_HYDROData_LandCoverMap::test_local_partition()
+{
+ 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() );
+
+
+
+ aDoc->Close();
+}
+
--- /dev/null
+// Copyright (C) 2014-2015 EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifdef WIN32
+ #pragma warning( disable: 4251 )
+#endif
+
+#include <cppunit/extensions/HelperMacros.h>
+
+class test_HYDROData_LandCoverMap : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE( test_HYDROData_LandCoverMap );
+ CPPUNIT_TEST( test_local_partition );
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+ void test_local_partition();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_LandCoverMap );
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( test_HYDROData_LandCoverMap, "HYDROData_LandCoverMap" );
+
+#ifdef WIN32
+ #pragma warning( default: 4251 )
+#endif