From: asl Date: Thu, 21 Sep 2017 07:51:15 +0000 (+0300) Subject: refs #1330: type/size support for polyline arrow X-Git-Tag: v2.1~66^2~13^2~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f2d56cdf4234ef53ad1c12586fe83c1d80ddc3f6;p=modules%2Fhydro.git refs #1330: type/size support for polyline arrow --- diff --git a/src/HYDROGUI/HYDROGUI_Polyline.h b/src/HYDROGUI/HYDROGUI_Polyline.h index 130dc879..18aa9ecb 100644 --- a/src/HYDROGUI/HYDROGUI_Polyline.h +++ b/src/HYDROGUI/HYDROGUI_Polyline.h @@ -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 diff --git a/src/HYDRO_tests/reference_data/CMakeLists.txt b/src/HYDRO_tests/reference_data/CMakeLists.txt index 021ee7f6..beb7e9d6 100644 --- a/src/HYDRO_tests/reference_data/CMakeLists.txt +++ b/src/HYDRO_tests/reference_data/CMakeLists.txt @@ -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 diff --git a/src/HYDRO_tests/reference_data/Polyline_Presentation.png b/src/HYDRO_tests/reference_data/Polyline_Presentation.png index 0e9f0134..b48f1e0e 100644 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 index 00000000..d20e639e Binary files /dev/null and b/src/HYDRO_tests/reference_data/Polyline_Presentation_triangle.png differ diff --git a/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx b/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx index b3af935f..dfbf94ae 100644 --- a/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx +++ b/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -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()