]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #1330: type/size support for polyline arrow
authorasl <asl@opencascade.com>
Thu, 21 Sep 2017 07:51:15 +0000 (10:51 +0300)
committerasl <asl@opencascade.com>
Thu, 21 Sep 2017 07:51:15 +0000 (10:51 +0300)
src/HYDROGUI/HYDROGUI_Polyline.h
src/HYDRO_tests/reference_data/CMakeLists.txt
src/HYDRO_tests/reference_data/Polyline_Presentation.png
src/HYDRO_tests/reference_data/Polyline_Presentation_triangle.png [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_PolylineXY.cxx

index 130dc8791408562bc5206de720a65e8bfc0f6c5a..18aa9ecba4ba6b7204271617993e88002fd9ed55 100644 (file)
@@ -44,6 +44,8 @@ public:
 class HYDROGUI_Arrow : public AIS_Shape
 {
 public:
+  enum Type { None, Triangle, Cone };
+
   HYDROGUI_Arrow( const TopoDS_Edge& edge );
   virtual ~HYDROGUI_Arrow();
 
@@ -51,8 +53,18 @@ public:
                                                const Handle(Prs3d_Presentation)& aPresentation,
                                                const Standard_Integer aMode = 0 );
   
+  Type GetType() const;
+  void SetType( Type );
+
+  int  GetSize() const;
+  void SetSize( int );
+
 public:
   DEFINE_STANDARD_RTTIEXT(HYDROGUI_Arrow, AIS_Shape);
+
+private:
+  Type myType;
+  int  mySize;
 };
 
 #endif
index 021ee7f6b4d234ec511eb7d819814c59f0343b48..beb7e9d6bce6e3220b8962a0def09ed9c2e57eb4 100644 (file)
@@ -89,6 +89,7 @@ SET(REFERENCE_DATA
     NLD_water_areas_dcw.shp
     NLD_water_areas_dcw.shx
     Polyline_Presentation.png
+    Polyline_Presentation_triangle.png
     pp1.brep
     pp2.brep
     pp3.brep
index 0e9f0134bf46ea364e08f74c07b031cef2395a8d..b48f1e0efff6ef60300c3fdc781cf52215355057 100644 (file)
Binary files a/src/HYDRO_tests/reference_data/Polyline_Presentation.png and b/src/HYDRO_tests/reference_data/Polyline_Presentation.png differ
diff --git a/src/HYDRO_tests/reference_data/Polyline_Presentation_triangle.png b/src/HYDRO_tests/reference_data/Polyline_Presentation_triangle.png
new file mode 100644 (file)
index 0000000..d20e639
Binary files /dev/null and b/src/HYDRO_tests/reference_data/Polyline_Presentation_triangle.png differ
index b3af935f64ed9b79cc50d5d56da586bffc6f44e3..dfbf94ae0a9d6fb17ce0e733d86293e1257f2a05 100644 (file)
@@ -28,6 +28,7 @@
 #include <HYDROData_ImmersibleZone.h>
 #include <HYDROData_Tool.h>
 #include <HYDROGUI_Shape.h>
+#include <HYDROGUI_Polyline.h>
 
 #include <AIS_DisplayMode.hxx>
 #include <AIS_PointCloud.hxx>
@@ -258,6 +259,14 @@ void test_HYDROData_PolylineXY::test_presentation()
   HYDROGUI_Shape* aNewPolylinePrs = new HYDROGUI_Shape( TestViewer::context(), aPolyline2d );
   aNewPolylinePrs->update( true, true );
 
+
+  // Check default type
+  Handle(HYDROGUI_Arrow) arr = Handle(HYDROGUI_Arrow)::DownCast( aNewPolylinePrs->getAISObjects()[1] );
+  CPPUNIT_ASSERT_EQUAL( HYDROGUI_Arrow::Cone, arr->GetType() );
+
+  
+  // Check polyline presentation with default (cone) arrow
+  TestViewer::eraseAll(true);
   TestViewer::show( aPointsPrs, AIS_PointCloud::DM_Points, 0, true, "Polyline_Presentation" );
   TestViewer::show( aPolyline2d->GetShape(), 0, true, Qt::red );
   //TestViewer::show( aNewPolylinePrs, AIS_PointCloud::DM_Points, 0, true, "" );
@@ -265,8 +274,20 @@ void test_HYDROData_PolylineXY::test_presentation()
   TestViewer::fitAll();
   CPPUNIT_ASSERT_IMAGES
 
+
+  // Check polyline presentation with triangle arrow
+  arr->SetType( HYDROGUI_Arrow::Triangle );
+  TestViewer::eraseAll(true);
+  TestViewer::show( aPointsPrs, AIS_PointCloud::DM_Points, 0, true, "Polyline_Presentation_triangle" );
+  TestViewer::show( aPolyline2d->GetShape(), 0, true, Qt::red );
+  //TestViewer::show( aNewPolylinePrs, AIS_PointCloud::DM_Points, 0, true, "" );
+  TestViewer::context()->RecomputePrsOnly( arr );
+  aNewPolylinePrs->display();
+  TestViewer::fitAll();
+  CPPUNIT_ASSERT_IMAGES
+
+  //QTest::qWait( 50000 );  
   aDoc->Close();
-  //QTest::qWait( 50000 );
 }
 
 void test_HYDROData_PolylineXY::test_split_refs_627()