#include <AIS_InteractiveContext.hxx>
#include <AIS_Shape.hxx>
#include <Aspect_ColorScale.hxx>
+#include <Prs3d_PointAspect.hxx>
#include <TopoDS_Iterator.hxx>
#include <QDir>
#include <QPainter>
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 );
#include <HYDROData_Document.h>
#include <HYDROData_PolylineXY.h>
+#include <HYDROData_PolylineOperator.h>
+#include <HYDROData_Iterator.h>
+#include <HYDROData_Tool.h>
+#include <QColor>
#include <QList>
#include <QPointF>
+#include <TestViewer.h>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Wire.hxx>
+
+TopoDS_Edge Spline( const QList<double>& theXYList, bool isClosed = false );
+
+
+
+
void test_HYDROData_PolylineXY::testPolyline()
{
Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
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<double> aCoords = QList<double>() << 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();
+}
+
#include <cppunit/extensions/HelperMacros.h>
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:
// checks the image properties copy/paste
void testCopy();
+
+ void testSplit_refs_624();
};
CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_PolylineXY);