#include <HYDROData_Iterator.h>
#include <HYDROData_ImmersibleZone.h>
#include <HYDROData_Tool.h>
+#include <HYDROGUI_Shape.h>
#include <HYDROGUI_Polyline.h>
#include <AIS_DisplayMode.hxx>
#include <QColor>
#include <QList>
#include <QPointF>
+#include <QTest>
#include <TestShape.h>
#include <TestViewer.h>
aPolyline->SetName( "test" );
QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
- TopoDS_Wire aWire = Wire( aCoords, true );
+ TopoDS_Wire aWire = Wire2d( aCoords, true );
aPolyline->SetShape( aWire );
gp_Pnt2d aPnt( 20, 20 );
aPolyline->SetName( "test" );
QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
- TopoDS_Wire aWire = Wire( aCoords, true );
+ TopoDS_Wire aWire = Wire2d( aCoords, true );
aPolyline->SetShape( aWire );
Handle(HYDROData_ImmersibleZone) aZone =
aPolyline3d->SetPolylineXY( aPolyline2d );
QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
- TopoDS_Wire aWire = Wire( aCoords, false );
+ TopoDS_Wire aWire = Wire2d( aCoords, false );
aPolyline2d->SetShape( aWire );
aPolyline3d->SetTopShape( aWire );
aPolyline3d->SetShape3D( aWire );
Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) );
aProfile->SetName( "profile_1" );
- QList<double> aCoordsPr = QList<double>() << 0.0 << 0.1 << 0.5 << 0.0 << 1.0 << 0.1;
- TopoDS_Wire aWirePr = Wire( aCoordsPr, false );
+ QList<double> aCoordsPr = QList<double>() << 0.0 << 0.1 << 0.0 << 0.0 << 1.0 << 0.0;
+ TopoDS_Wire aWirePr = Wire3d( aCoordsPr, false );
aProfile->SetTopShape( aWirePr );
aProfile->SetShape3D( aWirePr );
aPointsPrs->SetColor( Quantity_NOC_BLUE1 );
aPointsPrs->Attributes()->PointAspect()->SetTypeOfMarker( Aspect_TOM_O );
- Handle(HYDROGUI_Polyline) aNewPolylinePrs = new HYDROGUI_Polyline( aPolyline2d->GetShape() );
- aNewPolylinePrs->SetColor( Quantity_NOC_DARKGREEN );
+ aPolyline2d->SetWireColor( Qt::darkGreen );
+ 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() );
+ CPPUNIT_ASSERT_EQUAL( 35, arr->GetSize() );
+
+
+ // 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, "" );
+ //TestViewer::show( aNewPolylinePrs, AIS_PointCloud::DM_Points, 0, true, "" );
+ aNewPolylinePrs->setBorderColor( Qt::blue );
+ aNewPolylinePrs->display();
+ 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();
}
aPolyline->SetName( "test" );
QList<double> aCoords = QList<double>() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20;
- TopoDS_Wire aWire = Wire( aCoords, false );
+ TopoDS_Wire aWire = Wire2d( aCoords, false );
aPolyline->SetShape( aWire );
aPolyline->SetWireColor( Qt::red );
CPPUNIT_ASSERT_EQUAL( false, aPolyline1->IsCustom() );
CPPUNIT_ASSERT_EQUAL( false, aPolyline2->IsCustom() );
- aPolyline2->SetShape( Wire( QList<double>() << 0 << 0 << 10 << 10 << 20 << 0 ) );
+ aPolyline2->SetShape( Wire2d( QList<double>() << 0 << 0 << 10 << 10 << 20 << 0 ) );
CPPUNIT_ASSERT_EQUAL( true, aPolyline2->IsCustom() );
HYDROData_PolylineXY::PointsList aPointsList = aPolyline2->GetPoints( 0 );