From 7f6a67a5b0ca7be95649a25ed3632217ac9fd35d Mon Sep 17 00:00:00 2001 From: asl Date: Wed, 21 Oct 2015 13:43:04 +0300 Subject: [PATCH] refs #624: test for split polylines --- src/HYDRO_tests/TestViewer.cxx | 3 ++ .../LandCoverMap_Split_Polyline.png | Bin 0 -> 6052 bytes src/HYDRO_tests/test_HYDROData_PolylineXY.cxx | 50 ++++++++++++++++++ src/HYDRO_tests/test_HYDROData_PolylineXY.h | 9 ++-- 4 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 src/HYDRO_tests/reference_data/LandCoverMap_Split_Polyline.png diff --git a/src/HYDRO_tests/TestViewer.cxx b/src/HYDRO_tests/TestViewer.cxx index f54fdfc0..f3bd5105 100644 --- a/src/HYDRO_tests/TestViewer.cxx +++ b/src/HYDRO_tests/TestViewer.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -109,6 +110,8 @@ void TestViewer::show( const Handle(AIS_InteractiveObject)& theObject, void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor ) { Handle(AIS_Shape) aShape = new AIS_Shape( theShape ); + if( theShape.ShapeType()==TopAbs_VERTEX ) + aShape->Attributes()->PointAspect()->SetTypeOfMarker( Aspect_TOM_X ); aShape->SetMaterial( Graphic3d_NOM_PLASTIC ); aShape->SetColor( HYDROData_Tool::toOccColor( theColor ) ); context()->Display( aShape, theMode, 0, Standard_False ); diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Split_Polyline.png b/src/HYDRO_tests/reference_data/LandCoverMap_Split_Polyline.png new file mode 100644 index 0000000000000000000000000000000000000000..98c5e924fc372473b77e5369631f12e84364d8e0 GIT binary patch literal 6052 zcma)A2|QG7+rQ44-M*#CI`)Z{$-Xq4EGZQeDrqswlalSRv5!KLoDM(h@2X03f|^ zfulPBg#&;4dx?p8EfXvo5pC~L?S^}M)PMKr4)hCMmBEQv`pP&tdr5vISK9mz#>kLg z<+5q&DWmgTW)Mf5t|ii4KQG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{i0F&DPI$RndHcL5dt`jKb=-T+IYpKH*%SAL5+kZFN&_lfer~pPRq;jBO~7{Z?(TQ~dGSInA7?^UfOE z+iPd}l#Lh^H#djZ@_k~({V&E$o_#|2#})_2)ZFl;e&pGlGuIT|dh_XKJ$YN~{XX=) zBkRDnH!FN%`m2pr6pn1VyBT3S5}r@=Bm84wdq?KhGR6KInlXKKpK9lRe-yLy0;9;e znDRbUIeSqt(tdBM&qz<+i|DS?>16{V2iZ3kG+0Y>eKvf;C0B(@Hb^^rdF1N@~^S(QK?X4d@yLN8*+*A@$ z@Y5UGO!i>bPn3^vYXJ3J9QC(WkNs4&|M&_^+tD9wJAd@myN&g??$#WAUqhPkf&`G!g8h1KqU~gl%(!#Asl5Ms+0Twu;upb9*XNA*S*zQY z|Gxf5de&&fkJ}N}(Iz!xQ!Bho-HNO<&qfowZ#>ho@rh(Zr525Q@^!J$ihN0h*=u<3UUhlCl8 zLO|*6GGFfx{;EI-=<`}|srMzE$q!3Ih|Ps_6(85Ck?&4;*HxBy$Clyz!nqKNcQ~^51~Ecye4#?&n6r6n z2i@|75QMb7!I^cdjcY$hdF@XDp+k~Fpbg&7l7#tw+^$_gj3TSs2(~Wika^=4Xp`fB zpOBlsE1Sa3;vs}w(xF=;V#*wU3)bz6yI(~1TH}|XY>aW= W`MSsX{$!Q$^+G3C$3lBy{C@#bi@GiV literal 0 HcmV?d00001 diff --git a/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx b/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx index 95a89ee8..ee08e8bb 100644 --- a/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx +++ b/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx @@ -20,10 +20,26 @@ #include #include +#include +#include +#include +#include #include #include +#include +#include +#include +#include +#include +#include + +TopoDS_Edge Spline( const QList& theXYList, bool isClosed = false ); + + + + void test_HYDROData_PolylineXY::testPolyline() { Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 ); @@ -72,3 +88,37 @@ void test_HYDROData_PolylineXY::testCopy() aDoc->Close(); } + +void test_HYDROData_PolylineXY::testSplit_refs_624() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 ); + + Handle(HYDROData_PolylineXY) aPolyline = + Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); + aPolyline->SetName( "test" ); + + QList aCoords = QList() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20; + TopoDS_Wire aWire = BRepBuilderAPI_MakeWire( Spline( aCoords, true ) ).Wire(); + aPolyline->SetShape( aWire ); + + gp_Pnt2d aPnt( 20, 20 ); + + TestViewer::show( aPolyline->GetShape(), 0, true, "LandCoverMap_Split_Polyline" ); + //TestViewer::show( BRepBuilderAPI_MakeVertex( aPnt ).Vertex(), 1, true, Qt::green ); + CPPUNIT_ASSERT_IMAGES + + HYDROData_PolylineOperator anOp; + CPPUNIT_ASSERT_EQUAL( true, anOp.Split( aDoc, aPolyline, aPnt, 1E-3 ) ); + + HYDROData_Iterator anIt( aDoc, KIND_POLYLINEXY ); + CPPUNIT_ASSERT_EQUAL( true, anIt.More() ); + CPPUNIT_ASSERT_EQUAL( QString( "test" ), anIt.Current()->GetName() ); + anIt.Next(); + CPPUNIT_ASSERT_EQUAL( true, anIt.More() ); + CPPUNIT_ASSERT_EQUAL( QString( "test_1" ), anIt.Current()->GetName() ); + anIt.Next(); + CPPUNIT_ASSERT_EQUAL( false, anIt.More() ); + + aDoc->Close(); +} + diff --git a/src/HYDRO_tests/test_HYDROData_PolylineXY.h b/src/HYDRO_tests/test_HYDROData_PolylineXY.h index 24623b3c..e67e36f3 100644 --- a/src/HYDRO_tests/test_HYDROData_PolylineXY.h +++ b/src/HYDRO_tests/test_HYDROData_PolylineXY.h @@ -19,9 +19,10 @@ #include class test_HYDROData_PolylineXY : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(test_HYDROData_PolylineXY); - CPPUNIT_TEST(testPolyline); - CPPUNIT_TEST(testCopy); + CPPUNIT_TEST_SUITE( test_HYDROData_PolylineXY ); + CPPUNIT_TEST( testPolyline ); + CPPUNIT_TEST( testCopy ); + CPPUNIT_TEST( testSplit_refs_624 ); CPPUNIT_TEST_SUITE_END(); private: @@ -37,6 +38,8 @@ public: // checks the image properties copy/paste void testCopy(); + + void testSplit_refs_624(); }; CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_PolylineXY); -- 2.39.2