#include <TColgp_HArray1OfPnt.hxx>
#include <QPainterPath>
-#ifndef LIGHT_MODE
#include <CurveCreator_Utils.hxx>
-#endif
Handle(Geom_BSplineCurve) HYDROData_BSplineOperation::ComputeCurve(
const NCollection_Sequence<gp_XYZ>& thePoints,
// compute BSpline
Handle(Geom_BSplineCurve) aBSpline;
-#ifndef LIGHT_MODE
if( CurveCreator_Utils::constructBSpline( aHCurvePoints, theIsClosed, aBSpline ) )
return aBSpline;
else
-#endif
return Handle(Geom_BSplineCurve)();
}
#include <BRep_Tool.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <GeomAdaptor_Curve.hxx>
+#include <Graphic3d_AspectLine3d.hxx>
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <Prs3d_Arrow.hxx>
aPrs->Clear();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup( aPrs );
- Handle(Graphic3d_AspectLine3d) anAspect = Attributes()->FaceBoundaryAspect()->Aspect();
- aGroup->SetGroupPrimitivesAspect( anAspect );
+ Quantity_Color aColor;
+ Aspect_TypeOfLine aType;
+ Standard_Real anWidth;
+ Attributes()->LineAspect()->Aspect()->Values( aColor, aType, anWidth );
+ Handle(Graphic3d_AspectLine3d) anAspect = new Graphic3d_AspectLine3d( aColor, aType, anWidth );
TopExp_Explorer Exp1 ( myshape, TopAbs_EDGE );
for ( ; Exp1.More(); Exp1.Next() )
TopoDS_Edge anEdge = TopoDS::Edge( Exp1.Current() );
Handle( Graphic3d_ArrayOfPolylines ) anArray = BuildEdgePresentation( anEdge, 0.1 );
if( !anArray.IsNull() )
- aGroup->AddPrimitiveArray ( anArray );
+ {
+ aGroup->SetPrimitivesAspect( anAspect );
+ aGroup->AddPrimitiveArray( anArray );
+ }
}
SET( CAS_INCLUDES $ENV{CAS_ROOT_DIR}/inc )
SET( QT_INCLUDES $ENV{QT4_ROOT_DIR}/include $ENV{QT4_ROOT_DIR}/include/QtCore $ENV{QT4_ROOT_DIR}/include/QtGui $ENV{QT4_ROOT_DIR}/include/QtTest )
SET( GUI_INCLUDES $ENV{GUI_ROOT_DIR}/include/salome )
+SET( GEOM_INCLUDES $ENV{GEOM_ROOT_DIR}/include/salome )
IF( ${WIN32} )
link_directories( $ENV{CAS_ROOT_DIR}/win32/libd )
SET( CPPUNIT_LIBRARIES cppunit )
ENDIF()
-link_directories( $ENV{GUI_ROOT_DIR}/lib/salome )
+link_directories( $ENV{GUI_ROOT_DIR}/lib/salome $ENV{GEOM_ROOT_DIR}/lib/salome )
SET( GUI_LIBRARIES ImageComposer qtx suit LightApp CAM OCCViewer )
+SET( GEOM_LIBRARIES CurveCreator )
include_directories(
${BOOST_INCLUDES}
${QT_INCLUDES}
${CPPUNIT_INCLUDES}
${GUI_INCLUDES}
+ ${GEOM_INCLUDES}
${CMAKE_CURRENT_SOURCE_DIR}/../HYDROData
${CMAKE_CURRENT_SOURCE_DIR}/../HYDROGUI
${CMAKE_CURRENT_SOURCE_DIR}/../shapelib
source_group( "External files" FILES ${EXTERNAL_FILES} )
add_executable( HYDROData_tests ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${EXTERNAL_FILES} )
-target_link_libraries( HYDROData_tests ${GUI_LIBRARIES} ${CAS_LIBRARIES} ${QT_LIBRARIES} ${CPPUNIT_LIBRARIES} shapelib )
+target_link_libraries( HYDROData_tests ${GUI_LIBRARIES} ${GEOM_LIBRARIES} ${CAS_LIBRARIES} ${QT_LIBRARIES} ${CPPUNIT_LIBRARIES} shapelib )
IF( ${WIN32} )
add_custom_command( TARGET HYDROData_tests POST_BUILD COMMAND $(TargetPath) COMMENT "Running tests" )
../HYDROGUI/HYDROGUI_ListModel.cxx
../HYDROGUI/HYDROGUI_DataObject.cxx
../HYDROGUI/HYDROGUI_LandCoverMapPrs.cxx
+ ../HYDROGUI/HYDROGUI_Polyline.cxx
)
void TestViewer::show( const Handle(AIS_InteractiveObject)& theObject,
int theMode, int theSelectionMode, bool isFitAll, const char* theKey )
{
- context()->CloseLocalContext();
- context()->EraseAll( Standard_False );
+ QString aNewKey = theKey;
+ if( !aNewKey.isEmpty() )
+ {
+ myKey = aNewKey;
+ context()->CloseLocalContext();
+ context()->EraseAll( Standard_False );
+ }
+
+ context()->Display( theObject, theMode, theSelectionMode );
if( theSelectionMode > 0 )
{
- context()->Display( theObject, theMode, theSelectionMode );
context()->OpenLocalContext();
context()->Activate( theObject, theSelectionMode, Standard_True );
}
- myKey = theKey;
-
if( isFitAll )
{
viewWindow()->onTopView();
#include <HYDROData_Iterator.h>
#include <HYDROData_ImmersibleZone.h>
#include <HYDROData_Tool.h>
+#include <HYDROGUI_Polyline.h>
#include <AIS_DisplayMode.hxx>
+#include <AIS_PointCloud.hxx>
+#include <Prs3d_LineAspect.hxx>
+#include <Prs3d_PointAspect.hxx>
+#include <TColgp_HArray1OfPnt.hxx>
#include <QColor>
#include <QList>
#include <QPointF>
void test_HYDROData_PolylineXY::test_extraction_channel_refs_611()
{
-Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
Handle(HYDROData_PolylineXY) aPolyline2d =
Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
aDoc->Close();
}
+
+void test_HYDROData_PolylineXY::test_presentation()
+{
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+ Handle(HYDROData_PolylineXY) aPolyline2d =
+ Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+ aPolyline2d->SetName( "polyline2d_1" );
+ aPolyline2d->AddSection( "", HYDROData_IPolyline::SECTION_SPLINE, false );
+
+ QList<gp_XY> aPoints = QList<gp_XY>() << gp_XY( 0, 0 )
+ << gp_XY( 10, 10 )
+ << gp_XY( 20, 40 )
+ << gp_XY( 30, 10 )
+ << gp_XY( 40, 50 )
+ << gp_XY( 50, 60 )
+ << gp_XY( -10, 40 )
+ << gp_XY( -9, 39 )
+ << gp_XY( -8, 38 )
+ << gp_XY( 0, 20 );
+ Handle(TColgp_HArray1OfPnt) aPnts = new TColgp_HArray1OfPnt( 1, aPoints.size() );
+ int i = 1;
+ foreach( gp_XY aPoint, aPoints )
+ {
+ aPolyline2d->AddPoint( 0, aPoint );
+ aPnts->SetValue( i, gp_Pnt( aPoint.X(), aPoint.Y(), 0 ) );
+ i++;
+ }
+ aPolyline2d->Update();
+
+ CPPUNIT_ASSERT_EQUAL( false, (bool)aPolyline2d->GetShape().IsNull() );
+
+ Handle(AIS_PointCloud) aPointsPrs = new AIS_PointCloud();
+ aPointsPrs->SetPoints( aPnts );
+ 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 );
+
+ 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, "" );
+ CPPUNIT_ASSERT_IMAGES
+
+ aDoc->Close();
+}
CPPUNIT_TEST( testPolyline );
CPPUNIT_TEST( testCopy );
CPPUNIT_TEST( testSplit_refs_624 );
+ CPPUNIT_TEST( test_presentation );
CPPUNIT_TEST( test_extraction_immersible_zone );
CPPUNIT_TEST( test_extraction_channel_refs_611 );
CPPUNIT_TEST_SUITE_END();
void test_extraction_immersible_zone();
void test_extraction_channel_refs_611();
+ void test_presentation();
};
CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_PolylineXY);