]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx
Salome HOME
#649: draft version of the land cover map automatic test
[modules/hydro.git] / src / HYDRO_tests / test_HYDROData_LandCoverMap.cxx
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #include <test_HYDROData_LandCoverMap.h>
20 #include <HYDROData_Document.h>
21 #include <HYDROData_LandCoverMap.h>
22 #include <TopoDS_Edge.hxx>
23 #include <TColgp_HArray1OfPnt.hxx>
24 #include <GeomAPI_Interpolate.hxx>
25 #include <BRepBuilderAPI_MakeEdge.hxx>
26 #include <stdarg.h>
27
28 TopoDS_Edge Spline( bool isClosed, double x, double y, ... )
29 {
30   va_list anArgs;
31   va_start( anArgs, y );
32   QList<gp_Pnt> aPointsList;
33   while( true )
34   {
35     double x = va_arg( anArgs, double );
36     if( x <= 0 )
37       break;
38     double y = va_arg( anArgs, double );
39     gp_Pnt aPnt( x, y, 0 );
40     aPointsList.append( aPnt );
41   }
42   va_end( anArgs );
43
44   int n = aPointsList.size();
45   Handle(TColgp_HArray1OfPnt) aPointsArray = new TColgp_HArray1OfPnt( 1, n );
46   for( int i=1; i<=n; i++ )
47     aPointsArray->SetValue( i, aPointsList[i-1] );
48
49   GeomAPI_Interpolate anInterpolator( aPointsArray, isClosed, 1E-3 );
50   anInterpolator.Perform();
51   bool aResult = anInterpolator.IsDone() == Standard_True;
52   if( aResult )
53   {
54     Handle( Geom_BSplineCurve ) aCurve = anInterpolator.Curve();
55     return BRepBuilderAPI_MakeEdge( aCurve ).Edge();
56   }
57   else
58     return TopoDS_Edge();
59 }
60
61 void test_HYDROData_LandCoverMap::test_local_partition()
62 {
63   Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
64
65   Handle(HYDROData_LandCoverMap) aMap =
66     Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
67
68   CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() );
69
70
71
72   aDoc->Close();
73 }
74