Salome HOME
refs #561: the draft data model for Strickler table
[modules/hydro.git] / src / HYDROData / test_HYDROData_OperationsFactory.cxx
index bea1c987d75fd8b22dbc65085ed87a43813cbf0b..f9c08ec5484d56b0111146a2a56e9ae8bfa57c3d 100644 (file)
@@ -1,12 +1,32 @@
+// 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_OperationsFactory.h>
 
 #include <HYDROData_Document.h>
 #include <HYDROData_Image.h>
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
 #include <HYDROData_OperationsFactory.h>
 
 #include <ImageComposer_CropOperator.h>
 
+#include <gp_XY.hxx>
+
 #include <QPainter>
 
 void test_HYDROData_OperationsFactory::testCreate()
@@ -46,21 +66,15 @@ void test_HYDROData_OperationsFactory::testCrop()
   QImage aTestImage = TestImage();
   anOriImage->SetImage( aTestImage );
 
-  Handle(HYDROData_Polyline) aCropPolyline = 
-    Handle(HYDROData_Polyline)::DownCast( aDoc->CreateObject( KIND_POLYLINE ) );
-
-  HYDROData_Polyline::PolylineData aPolylineData;
-
-  PolylineSection aPolylineSect;
-
-  aPolylineSect.myCoords << 25 <<  0 << 0;
-  aPolylineSect.myCoords <<  0 << 20 << 0;
-  aPolylineSect.myCoords << 25 << 40 << 0;
-  aPolylineSect.myCoords << 50 << 20 << 0;
+  Handle(HYDROData_PolylineXY) aCropPolyline = 
+    Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
 
-  aPolylineData << aPolylineSect;
+  aCropPolyline->AddSection( "", HYDROData_PolylineXY::SECTION_POLYLINE, true );
 
-  aCropPolyline->setPolylineData( aPolylineData );
+  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 25, 0  ) );
+  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 0,  20 ) );
+  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 25, 40 ) );
+  aCropPolyline->AddPoint( 0, HYDROData_PolylineXY::Point( 50, 20 ) );
 
   // prepare Composer Operation
   ImageComposer_Operator* aCropOp =