From 19bb1eb5f4fdaeee19daa9bf28c7d0142467565d Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Thu, 1 Nov 2012 10:16:09 +0000 Subject: [PATCH] updated --- .../ArrangementDemoWindow.cpp | 36 ++-- .../ArrangementDemoWindow.h | 2 +- .../ArrangementGraphicsItem.cpp | 4 +- .../ArrangementPainterOstream.h | 24 ++- .../DeleteCurveCallback.h | 28 +-- .../FillFaceCallback.h | 22 +-- .../GraphicsViewCurveInput.cpp | 4 +- .../GraphicsViewCurveInput.h | 72 +++---- .../MergeEdgeCallback.h | 35 ++-- .../PointLocationCallback.h | 12 +- .../demo/Arrangement_on_surface_2/Utils.h | 181 ++++++++++-------- .../VerticalRayShootCallback.h | 71 ++++--- 12 files changed, 258 insertions(+), 233 deletions(-) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoWindow.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoWindow.cpp index 8a71a91774b..6a1982276cf 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoWindow.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoWindow.cpp @@ -43,7 +43,8 @@ ArrangementDemoWindow::ArrangementDemoWindow(QWidget* parent) : this->setupUi( ); // set up the demo window - ArrangementDemoTabBase* demoTab = this->makeTab( SEGMENT_TRAITS ); + // ArrangementDemoTabBase* demoTab = + this->makeTab( SEGMENT_TRAITS ); this->setupStatusBar( ); this->setupOptionsMenu( ); this->addAboutDemo( ":/help/about.html" ); @@ -135,7 +136,8 @@ ArrangementDemoTabBase* ArrangementDemoWindow::makeTab( TraitsType tt ) return demoTab; } -ArrangementDemoTabBase* ArrangementDemoWindow::getTab( int tabIndex ) const +ArrangementDemoTabBase* ArrangementDemoWindow::getTab( unsigned int tabIndex ) + const { if ( tabIndex < 0 || tabIndex > this->tabs.size( ) ) { @@ -333,8 +335,10 @@ void ArrangementDemoWindow::removeCallback( int tabIndex ) ArrangementDemoTabBase* activeTab = this->tabs[ tabIndex ]; QGraphicsScene* activeScene = activeTab->getScene( ); QGraphicsView* activeView = activeTab->getView( ); +#if 0 QAction* activeMode = this->activeModes[ tabIndex ]; - +#endif + activeScene->removeEventFilter( activeTab->getCurveInputCallback( ) ); activeView->setDragMode( QGraphicsView::NoDrag ); activeScene->removeEventFilter( activeTab->getDeleteCurveCallback( ) ); @@ -458,8 +462,8 @@ void ArrangementDemoWindow::openArrFile( QString filename ) tab->setArrangement( conic ); #endif typedef ArrangementDemoTab< Conic_arr > TabType; - Conic_reader< typename Conic_arr::Geometry_traits_2 > conicReader; - std::vector< typename Conic_arr::Curve_2 > curve_list; + Conic_reader< Conic_arr::Geometry_traits_2 > conicReader; + std::vector< Conic_arr::Curve_2 > curve_list; CGAL::Bbox_2 bbox; conicReader.read_data( filename.toStdString( ).c_str( ), std::back_inserter( curve_list ), bbox ); @@ -505,7 +509,7 @@ void ArrangementDemoWindow::openDatFile( QString filename ) Seg_arr* seg; Pol_arr* pol; Conic_arr* conic; - Alg_seg_arr* alg; + // Alg_seg_arr* alg; // Creates an ofstream object named inputFile if (! inputFile.is_open() ) // Always test file open @@ -578,7 +582,7 @@ void ArrangementDemoWindow::openDatFile( QString filename ) else if ( CGAL::assign( conic, arr ) ) { conic->clear( ); - Conic_reader< typename Conic_arr::Geometry_traits_2 > reader; + Conic_reader< Conic_arr::Geometry_traits_2 > reader; std::list curve_list; CGAL::Bbox_2 bbox; reader.read_data( filename.toStdString().c_str(), @@ -599,8 +603,8 @@ void ArrangementDemoWindow::updateEnvelope( QAction* newMode ) if ( this->ui->tabWidget->currentIndex( ) == -1 ) return; ArrangementDemoTabBase* activeTab = this->tabs[ this->ui->tabWidget->currentIndex( ) ]; - QGraphicsScene* activeScene = activeTab->getScene( ); - QGraphicsView* activeView = activeTab->getView( ); + // QGraphicsScene* activeScene = activeTab->getScene( ); + // QGraphicsView* activeView = activeTab->getView( ); bool show = newMode->isChecked( ); if ( newMode == this->ui->actionLowerEnvelope ) @@ -650,8 +654,8 @@ void ArrangementDemoWindow::updateConicType( QAction* newType ) { ArrangementDemoTabBase* activeTab = this->tabs[ this->ui->tabWidget->currentIndex( ) ]; - QGraphicsScene* activeScene = activeTab->getScene( ); - ArrangementDemoGraphicsView* activeView = activeTab->getView( ); + // QGraphicsScene* activeScene = activeTab->getScene( ); + // ArrangementDemoGraphicsView* activeView = activeTab->getView( ); Conic_arr* conic_arr; Lin_arr* lin_arr; bool isConicArr = @@ -663,7 +667,7 @@ void ArrangementDemoWindow::updateConicType( QAction* newType ) if ( isConicArr ) { // std::cout << "do something conic arr related" << std::endl; - typedef typename Conic_arr::Geometry_traits_2 Conic_geom_traits; + typedef Conic_arr::Geometry_traits_2 Conic_geom_traits; typedef CGAL::Qt::GraphicsViewCurveInput ConicCurveInputCallback; ConicCurveInputCallback* curveInputCallback = @@ -693,7 +697,7 @@ void ArrangementDemoWindow::updateConicType( QAction* newType ) } else if ( isLinearArr ) { - typedef typename Lin_arr::Geometry_traits_2 Line_geom_traits; + typedef Lin_arr::Geometry_traits_2 Line_geom_traits; typedef CGAL::Qt::GraphicsViewCurveInput LinearCurveInputCallback; LinearCurveInputCallback* curveInputCallback = @@ -756,7 +760,7 @@ void ArrangementDemoWindow::on_actionSaveAs_triggered( ) CGAL::write( *conic, ofs, arrFormatter ); #endif ofs << conic->number_of_curves( ) << std::endl; - for ( typename Conic_arr::Curve_iterator it = conic->curves_begin( ); + for ( Conic_arr::Curve_iterator it = conic->curves_begin( ); it != conic->curves_end( ); ++it ) { if ( it->is_full_conic( ) ) @@ -907,8 +911,8 @@ void ArrangementDemoWindow::on_tabWidget_currentChanged( ) if ( this->ui->tabWidget->currentIndex( ) != -1 ) arr = this->arrangements[ this->ui->tabWidget->currentIndex( ) ]; - Seg_arr* seg; - Pol_arr* pol; + // Seg_arr* seg; + // Pol_arr* pol; Conic_arr* conic; Lin_arr* lin; if ( CGAL::assign( conic, arr ) ) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoWindow.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoWindow.h index e6eb092e512..bcfcc6db3d2 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoWindow.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoWindow.h @@ -69,7 +69,7 @@ class ArrangementDemoWindow : public CGAL::Qt::DemosMainWindow ~ArrangementDemoWindow(); ArrangementDemoTabBase* makeTab( TraitsType tt ); - ArrangementDemoTabBase* getTab( int tabIndex ) const; + ArrangementDemoTabBase* getTab( unsigned int tabIndex ) const; ArrangementDemoTabBase* getCurrentTab( ) const; std::vector< QString > getTabLabels( ) const; diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.cpp index bf8b195baae..61341f44a33 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementGraphicsItem.cpp @@ -25,10 +25,10 @@ namespace Qt { ArrangementGraphicsItemBase::ArrangementGraphicsItemBase( ) : bb( 0, 0, 0, 0 ), bb_initialized( false ), - visible_edges( true ), - visible_vertices( true ), verticesPen( QPen( ::Qt::blue, 3. ) ), edgesPen( QPen( ::Qt::blue, 1. ) ), + visible_edges( true ), + visible_vertices( true ), scene( NULL ), backgroundColor( ::Qt::white ) { diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.h index 5be3b815a94..4aefd412d8b 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.h @@ -44,7 +44,8 @@ namespace Qt { template < typename ArrTraits > class ArrangementPainterOstreamBase : public QGraphicsSceneMixin { -public: // typedefs +public: + // typedefs typedef ArrTraits Traits; typedef typename ArrTraitsAdaptor< Traits >::Kernel Kernel; typedef typename Kernel::Point_2 Point_2; @@ -55,13 +56,14 @@ public: // typedefs typedef typename Kernel::Iso_rectangle_2 Iso_rectangle_2; typedef typename Kernel::Circle_2 Circle_2; -public: // constructors +public: + /*! Constructor */ ArrangementPainterOstreamBase( QPainter* p, - QRectF clippingRectangle = QRectF( ) ): + QRectF clippingRectangle = QRectF( ) ) : painterOstream( p, clippingRectangle ), qp( p ), convert( clippingRectangle ), - // scene( NULL ), + // scene( NULL ), clippingRect( QRectF( ) ), // null rectangle scale( 1.0 ) { @@ -71,7 +73,10 @@ public: // constructors } } -public: // methods + /*! Destructor (virtual) */ + ~ArrangementPainterOstreamBase() {} + + // methods template < typename T > ArrangementPainterOstreamBase& operator<<( const T& t ) { @@ -120,7 +125,8 @@ protected: // methods } #endif -protected: // fields +protected: + // fields PainterOstream< Kernel > painterOstream; QPainter* qp; Converter< Kernel > convert; @@ -135,9 +141,13 @@ class ArrangementPainterOstream: public ArrangementPainterOstreamBase< ArrTraits > { public: - ArrangementPainterOstream( QPainter* p, QRectF clippingRectangle = QRectF( ) ): + /*! Constructor */ + ArrangementPainterOstream(QPainter* p, QRectF clippingRectangle = QRectF()): ArrangementPainterOstreamBase< ArrTraits >( p, clippingRectangle ) { } + + /*! Destructor (virtual) */ + ~ArrangementPainterOstream() {} }; template < typename Kernel_ > diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/DeleteCurveCallback.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/DeleteCurveCallback.h index d66ab85f68c..d9af6095cff 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/DeleteCurveCallback.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/DeleteCurveCallback.h @@ -42,18 +42,18 @@ class DeleteCurveCallback : public CGAL::Qt::Callback { public: typedef Arr_ Arrangement; - typedef typename Arrangement::Halfedge_const_handle Halfedge_const_handle; - typedef typename Arrangement::Halfedge_handle Halfedge_handle; - typedef typename Arrangement::Halfedge_iterator Halfedge_iterator; - typedef typename Arrangement::Geometry_traits_2 Traits; - typedef typename Arrangement::Curve_handle Curve_handle; + typedef typename Arrangement::Halfedge_const_handle Halfedge_const_handle; + typedef typename Arrangement::Halfedge_handle Halfedge_handle; + typedef typename Arrangement::Halfedge_iterator Halfedge_iterator; + typedef typename Arrangement::Geometry_traits_2 Traits; + typedef typename Arrangement::Curve_handle Curve_handle; typedef typename Arrangement::Originating_curve_iterator Originating_curve_iterator; - typedef typename Arrangement::Induced_edge_iterator Induced_edge_iterator; - typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; - typedef typename ArrTraitsAdaptor< Traits >::Kernel Kernel; - typedef typename Kernel::Point_2 Point; - typedef typename Kernel::Segment_2 Segment; + typedef typename Arrangement::Induced_edge_iterator Induced_edge_iterator; + typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; + typedef typename ArrTraitsAdaptor< Traits >::Kernel Kernel; + typedef typename Kernel::Point_2 Point; + typedef typename Kernel::Segment_2 Segment; DeleteCurveCallback( Arrangement* arr_, QObject* parent_ ); void setScene( QGraphicsScene* scene_ ); @@ -73,14 +73,14 @@ protected: Halfedge_handle removableHalfedge; }; // class DeleteCurveCallback - +/*! Constructor */ template < typename Arr_ > DeleteCurveCallback< Arr_ >:: -DeleteCurveCallback( Arrangement* arr_, QObject* parent_ ): +DeleteCurveCallback( Arrangement* arr_, QObject* parent_ ) : CGAL::Qt::Callback( parent_ ), - arr( arr_ ), scene( NULL ), - highlightedCurve( new CGAL::Qt::CurveGraphicsItem< Traits >( ) ) + highlightedCurve( new CGAL::Qt::CurveGraphicsItem< Traits >( ) ), + arr( arr_ ) { QObject::connect( this, SIGNAL( modelChanged( ) ), this->highlightedCurve, SLOT( modelChanged( ) ) ); diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/FillFaceCallback.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/FillFaceCallback.h index 2f306ad680c..fedfb9a0ba6 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/FillFaceCallback.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/FillFaceCallback.h @@ -85,7 +85,7 @@ public: typedef typename CGAL::Arr_simple_point_location< Arrangement > SimplePointLocationStrategy; typedef typename CGAL::Arr_walk_along_line_point_location< Arrangement > - WalkAlongLinePointLocationStrategy; + Walk_pl_strategy; typedef typename Supports_landmarks< Arrangement >::LandmarksType LandmarksPointLocationStrategy; @@ -101,8 +101,10 @@ protected: Face_const_handle getFace( const CGAL::Object& o ); CGAL::Object locate( const Kernel_point_2& point ); - CGAL::Object locate( const Kernel_point_2& point, CGAL::Tag_false /*supportsLandmarks*/ ); - CGAL::Object locate( const Kernel_point_2& point, CGAL::Tag_true /*doesNotSupportLandmarks*/ ); + CGAL::Object locate( const Kernel_point_2& point, + CGAL::Tag_false/*supportsLandmarks*/ ); + CGAL::Object locate( const Kernel_point_2& point, + CGAL::Tag_true /*doesNotSupportLandmarks*/ ); CGAL::Qt::Converter< Kernel > convert; CGAL::Object pointLocationStrategy; @@ -110,15 +112,13 @@ protected: Arr_construct_point_2< Traits > toArrPoint; }; // class FillFaceCallback - +/*! Constructor */ template < class Arr_ > FillFaceCallback::FillFaceCallback(Arrangement* arr_, QObject* parent_): FillFaceCallbackBase( parent_ ), - arr( arr_ ), - pointLocationStrategy( CGAL::make_object( new WalkAlongLinePointLocationStrategy( *arr_ ) ) ) -{ - -} + pointLocationStrategy( CGAL::make_object( new Walk_pl_strategy( *arr_ ) ) ), + arr( arr_ ) +{ } template < class Arr_ > void FillFaceCallback< Arr_ >::reset( ) @@ -186,7 +186,7 @@ CGAL::Object FillFaceCallback< Arr_ >::locate( const Kernel_point_2& pt, CGAL::Tag_true ) { CGAL::Object pointLocationResult; - WalkAlongLinePointLocationStrategy* walkStrategy; + Walk_pl_strategy* walkStrategy; TrapezoidPointLocationStrategy* trapezoidStrategy; SimplePointLocationStrategy* simpleStrategy; LandmarksPointLocationStrategy* landmarksStrategy; @@ -217,7 +217,7 @@ CGAL::Object FillFaceCallback< Arr_ >::locate( const Kernel_point_2& pt, CGAL::Tag_false ) { CGAL::Object pointLocationResult; - WalkAlongLinePointLocationStrategy* walkStrategy; + Walk_pl_strategy* walkStrategy; TrapezoidPointLocationStrategy* trapezoidStrategy; SimplePointLocationStrategy* simpleStrategy; diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.cpp index 5bbb89cf529..631968d049d 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.cpp @@ -50,8 +50,8 @@ void GraphicsViewCurveInputBase::setSnapToGridEnabled( bool b ) this->snapToGridEnabled = b; } -GraphicsViewCurveInputBase:: -GraphicsViewCurveInputBase( QObject* parent ): +/*! Constructor */ +GraphicsViewCurveInputBase::GraphicsViewCurveInputBase( QObject* parent ) : GraphicsViewInput( parent ), // scene( NULL ), snappingEnabled( false ), diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.h index b211861569a..dee3300024d 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewCurveInput.h @@ -204,7 +204,8 @@ protected: this->points.push_back( clickedPoint ); QPointF pt = this->convert( clickedPoint ); - QGraphicsLineItem* lineItem = new QGraphicsLineItem( pt.x( ), pt.y( ), pt.x( ), pt.y( ) ); + QGraphicsLineItem* lineItem = + new QGraphicsLineItem( pt.x( ), pt.y( ), pt.x( ), pt.y( ) ); lineItem->setZValue( 100 ); QPen pen = lineItem->pen( ); pen.setColor( this->color ); @@ -239,7 +240,8 @@ protected: else { // start the next segment QPointF pt = this->convert( clickedPoint ); - QGraphicsLineItem* lineItem = new QGraphicsLineItem( pt.x( ), pt.y( ), pt.x( ), pt.y( ) ); + QGraphicsLineItem* lineItem = + new QGraphicsLineItem( pt.x( ), pt.y( ), pt.x( ), pt.y( ) ); lineItem->setZValue( 100 ); QPen pen = lineItem->pen( ); pen.setColor( this->color ); @@ -264,43 +266,45 @@ protected: std::vector< Point_2 > points; std::vector< QGraphicsLineItem* > polylineGuide; -}; // class GraphicsViewCurveInput< CGAL::Arr_polyline_traits_2< SegmentTraits > > +}; + + // class GraphicsViewCurveInput< CGAL::Arr_polyline_traits_2 > /** Specialization of GraphicsViewCurveInput for Arr_conic_traits_2; handles user-guided generation of conic curves. */ template < class RatKernel, class AlgKernel, class NtTraits > -class GraphicsViewCurveInput< CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits > >: +class GraphicsViewCurveInput< CGAL::Arr_conic_traits_2< + RatKernel, AlgKernel, NtTraits > >: public GraphicsViewCurveInputBase { public: typedef CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits > Traits; - typedef typename Traits::Curve_2 Curve_2; - typedef typename Traits::Point_2 Point_2; // basically, an AlgKernel::Point_2 with metadata - typedef typename Traits::Construct_x_monotone_curve_2 Construct_x_monotone_curve_2; - typedef AlgKernel Kernel; - //typedef typename Kernel::Point_2 Point_2; - typedef typename Kernel::Segment_2 Segment_2; - typedef typename RatKernel::FT Rat_FT; - typedef typename RatKernel::Point_2 Rat_point_2; - typedef typename RatKernel::Segment_2 Rat_segment_2; - typedef typename RatKernel::Circle_2 Rat_circle_2; - typedef enum ConicType - { - CONIC_SEGMENT, - CONIC_CIRCLE, - CONIC_ELLIPSE, - CONIC_THREE_POINT, - CONIC_FIVE_POINT - } ConicType; + typedef typename Traits::Curve_2 Curve_2; + // basically, an AlgKernel::Point_2 with metadata + typedef typename Traits::Point_2 Point_2; + typedef AlgKernel Kernel; + // typedef typename Kernel::Point_2 Point_2; + typedef typename Kernel::Segment_2 Segment_2; + typedef typename RatKernel::FT Rat_FT; + typedef typename RatKernel::Point_2 Rat_point_2; + typedef typename RatKernel::Segment_2 Rat_segment_2; + typedef typename RatKernel::Circle_2 Rat_circle_2; + typedef enum ConicType { + CONIC_SEGMENT, + CONIC_CIRCLE, + CONIC_ELLIPSE, + CONIC_THREE_POINT, + CONIC_FIVE_POINT + } ConicType; - GraphicsViewCurveInput( QObject* parent ): + /*! Constructor */ + GraphicsViewCurveInput( QObject* parent ) : GraphicsViewCurveInputBase( parent ), - construct_x_monotone_curve_2( this->traits.construct_x_monotone_curve_2_object( ) ), - conicType( CONIC_SEGMENT ), circleItem( NULL ), - ellipseItem( NULL ) + ellipseItem( NULL ), + conicType( CONIC_SEGMENT ) { } void setConicType( ConicType conicType_ ) @@ -335,7 +339,8 @@ protected: double radius = sqrt( (p1.x( ) - p2.x( ))*(p1.x( ) - p2.x( )) + (p1.y( ) - p2.y( ))*(p1.y( ) - p2.y( )) ); double d = radius * sqrt( 2.0 ); - this->circleItem->setRect( p1.x( ) - radius, p1.y( ) - radius, 2*radius, 2*radius ); + this->circleItem->setRect( p1.x( ) - radius, p1.y( ) - + radius, 2*radius, 2*radius ); } if ( this->ellipseItem != NULL ) { @@ -392,7 +397,8 @@ protected: QPointF pt = this->convert( clickedPoint ); if ( this->scene != NULL ) { - QGraphicsEllipseItem* ellipse = this->scene->addEllipse( pt.x( ), pt.y( ), 0, 0 ); + QGraphicsEllipseItem* ellipse = + this->scene->addEllipse( pt.x( ), pt.y( ), 0, 0 ); ellipse->setZValue( 100 ); QPen pen = ellipse->pen( ); pen.setColor( this->color ); @@ -415,12 +421,12 @@ protected: } this->polylineGuide.clear( ); - //Curve_2 res = this->construct_x_monotone_curve_2( this->points[ 0 ], this->points[ 1 ] ); double x1 = CGAL::to_double( this->points[ 0 ].x( ) ); double y1 = CGAL::to_double( this->points[ 0 ].y( ) ); double x2 = CGAL::to_double( this->points[ 1 ].x( ) ); double y2 = CGAL::to_double( this->points[ 1 ].y( ) ); - Curve_2 res = Curve_2( Rat_segment_2( Rat_point_2( x1, y1 ), Rat_point_2( x2, y2 ) ) ); + Curve_2 res = Curve_2( Rat_segment_2( Rat_point_2( x1, y1 ), + Rat_point_2( x2, y2 ) ) ); // std::cout << "res is " << ( (res.is_valid( ))? "" : "not ") // << "valid" << std::endl; this->points.clear( ); @@ -568,9 +574,11 @@ protected: QGraphicsEllipseItem* ellipseItem; Traits traits; - Construct_x_monotone_curve_2 construct_x_monotone_curve_2; ConicType conicType; -}; // class GraphicsViewCurveInput< CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits > > +}; + +// class GraphicsViewCurveInput< CGAL::Arr_conic_traits_2< +// RatKernel, AlgKernel, NtTraits > > /** Specialization of GraphicsViewCurveInput for Arr_linear_traits_2; handles diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/MergeEdgeCallback.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/MergeEdgeCallback.h index fe4e93096bc..5543b11f995 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/MergeEdgeCallback.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/MergeEdgeCallback.h @@ -39,18 +39,18 @@ class MergeEdgeCallback : public CGAL::Qt::Callback { public: typedef Arr_ Arrangement; - typedef typename Arrangement::Halfedge_handle Halfedge_handle; - typedef typename Arrangement::Halfedge_iterator Halfedge_iterator; - typedef typename Arrangement::Vertex_iterator Vertex_iterator; - typedef typename Arrangement::Geometry_traits_2 Traits; - typedef typename Arrangement::Curve_handle Curve_handle; + typedef typename Arrangement::Halfedge_handle Halfedge_handle; + typedef typename Arrangement::Halfedge_iterator Halfedge_iterator; + typedef typename Arrangement::Vertex_iterator Vertex_iterator; + typedef typename Arrangement::Geometry_traits_2 Traits; + typedef typename Arrangement::Curve_handle Curve_handle; typedef typename Arrangement::Originating_curve_iterator Originating_curve_iterator; - typedef typename Arrangement::Induced_edge_iterator Induced_edge_iterator; - typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; - typedef typename ArrTraitsAdaptor< Traits >::Kernel Kernel; - typedef typename Kernel::Point_2 Kernel_point_2; - typedef typename Kernel::Segment_2 Segment; + typedef typename Arrangement::Induced_edge_iterator Induced_edge_iterator; + typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; + typedef typename ArrTraitsAdaptor< Traits >::Kernel Kernel; + typedef typename Kernel::Point_2 Kernel_point_2; + typedef typename Kernel::Segment_2 Segment; MergeEdgeCallback( Arrangement* arr_, QObject* parent_ ); void setScene( QGraphicsScene* scene_ ); @@ -74,15 +74,15 @@ protected: bool isFirst; }; // class MergeEdgeCallback - +/*! Constructor */ template < typename Arr_ > MergeEdgeCallback< Arr_ >::MergeEdgeCallback( Arrangement* arr_, - QObject* parent_ ): + QObject* parent_ ) : CGAL::Qt::Callback( parent_ ), - arr( arr_ ), scene( NULL ), highlightedCurve( new CGAL::Qt::CurveGraphicsItem< Traits >( ) ), highlightedCurve2( new CGAL::Qt::CurveGraphicsItem< Traits >( ) ), + arr( arr_ ), isFirst( true ) { QObject::connect( this, SIGNAL( modelChanged( ) ), @@ -245,14 +245,7 @@ getNearestMergeableCurve( Halfedge_handle h, QGraphicsSceneMouseEvent* event ) X_monotone_curve_2 c2 = h2->curve( ); double d1 = CGAL::to_double( this->squaredDistance( p, c1 ) ); double d2 = CGAL::to_double( this->squaredDistance( p, c2 ) ); - if ( d1 < d2 ) - { - return h1; - } - else - { - return h2; - } + return ( d1 < d2 ) ? h1 : h2; } } #endif // MERGE_EDGE_CALLBACK_H diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointLocationCallback.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointLocationCallback.h index c4296d9c9e3..c56d815a3ae 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointLocationCallback.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointLocationCallback.h @@ -72,7 +72,7 @@ public: typedef typename CGAL::Arr_simple_point_location< Arrangement > SimplePointLocationStrategy; typedef typename CGAL::Arr_walk_along_line_point_location< Arrangement > - WalkAlongLinePointLocationStrategy; + Walk_pl_strategy; typedef typename Supports_landmarks< Arrangement >::LandmarksType LandmarksPointLocationStrategy; @@ -103,14 +103,14 @@ protected: Arr_construct_point_2< Traits > toArrPoint; }; // class PointLocationCallback - +/*! Constructor */ template < typename Arr_ > PointLocationCallback< Arr_ >:: PointLocationCallback( Arrangement* arr_, QObject* parent_ ) : CGAL::Qt::Callback( parent_ ), + pointLocationStrategy( CGAL::make_object( new Walk_pl_strategy( *arr_ ) ) ), arr( arr_ ), - highlightedCurves( new CGAL::Qt::CurveGraphicsItem< Traits >( ) ), - pointLocationStrategy( CGAL::make_object( new WalkAlongLinePointLocationStrategy( *arr_ ) ) ) + highlightedCurves( new CGAL::Qt::CurveGraphicsItem< Traits >( ) ) { QObject::connect( this, SIGNAL( modelChanged( ) ), this->highlightedCurves, SLOT( modelChanged( ) ) ); @@ -261,7 +261,7 @@ CGAL::Object PointLocationCallback< Arr_ >::locate( const Kernel_point_2& pt, CGAL::Tag_true ) { CGAL::Object pointLocationResult; - WalkAlongLinePointLocationStrategy* walkStrategy; + Walk_pl_strategy* walkStrategy; TrapezoidPointLocationStrategy* trapezoidStrategy; SimplePointLocationStrategy* simpleStrategy; LandmarksPointLocationStrategy* landmarksStrategy; @@ -292,7 +292,7 @@ CGAL::Object PointLocationCallback< Arr_ >::locate( const Kernel_point_2& pt, CGAL::Tag_false ) { CGAL::Object pointLocationResult; - WalkAlongLinePointLocationStrategy* walkStrategy; + Walk_pl_strategy* walkStrategy; TrapezoidPointLocationStrategy* trapezoidStrategy; SimplePointLocationStrategy* simpleStrategy; diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils.h index 05674faa53e..f21597e619b 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/Utils.h @@ -30,16 +30,21 @@ #include #include #include -#include "ArrangementTypes.h" #include +#include "ArrangementTypes.h" + class QGraphicsScene; class QGraphicsSceneMixin { public: + /*! Costructor */ QGraphicsSceneMixin( ) : scene( 0 ) { } + /*! Destructor (virtual) */ + ~QGraphicsSceneMixin() {} + virtual void setScene( QGraphicsScene* scene_ ) { this->scene = scene_; } virtual QGraphicsScene* getScene( ) const { return this->scene; } @@ -363,8 +368,10 @@ public: }; template < class CircularKernel > -class Compute_squared_distance_2< CGAL::Arr_circular_arc_traits_2< CircularKernel > > : - public Compute_squared_distance_2_base< CGAL::Arr_circular_arc_traits_2< CircularKernel > > +class Compute_squared_distance_2< CGAL::Arr_circular_arc_traits_2< + CircularKernel > > : + public Compute_squared_distance_2_base< CGAL::Arr_circular_arc_traits_2< + CircularKernel > > { public: // typedefs typedef CircularKernel Kernel; @@ -392,15 +399,16 @@ class Compute_squared_distance_2< CGAL::Arr_conic_traits_2< RatKernel, AlgKernel public Compute_squared_distance_2_base< CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits > > { public: - typedef AlgKernel Kernel; + typedef AlgKernel Kernel; typedef CGAL::Arr_conic_traits_2< RatKernel, AlgKernel, NtTraits > Traits; - typedef Compute_squared_distance_2_base< Traits > Superclass; - typedef typename Traits::Point_2 Conic_point_2; // _Conic_point_2< AlgKernel > : public AlgKernel::Point_2 - typedef typename Kernel::FT FT; - typedef typename Kernel::Point_2 Point_2; - typedef typename Kernel::Segment_2 Segment_2; - typedef typename Traits::Curve_2 Curve_2; - typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; + typedef Compute_squared_distance_2_base< Traits > Superclass; + // _Conic_point_2< AlgKernel > : public AlgKernel::Point_2 + typedef typename Traits::Point_2 Conic_point_2; + typedef typename Kernel::FT FT; + typedef typename Kernel::Point_2 Point_2; + typedef typename Kernel::Segment_2 Segment_2; + typedef typename Traits::Curve_2 Curve_2; + typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; public: // methods double operator() ( const Point_2& p, const X_monotone_curve_2& c ) const @@ -505,14 +513,14 @@ class Arr_compute_y_at_x_2 : public QGraphicsSceneMixin { public: typedef ArrTraits Traits; - typedef typename ArrTraitsAdaptor< Traits >::Kernel Kernel; + typedef typename ArrTraitsAdaptor< Traits >::Kernel Kernel; typedef typename ArrTraitsAdaptor< Traits >::CoordinateType CoordinateType; //typedef typename Kernel::FT FT; - typedef typename Kernel::Point_2 Point_2; - typedef typename Kernel::Line_2 Line_2; - typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; - typedef typename Traits::Multiplicity Multiplicity; - typedef typename Traits::Intersect_2 Intersect_2; + typedef typename Kernel::Point_2 Point_2; + typedef typename Kernel::Line_2 Line_2; + typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; + typedef typename Traits::Multiplicity Multiplicity; + typedef typename Traits::Intersect_2 Intersect_2; typedef std::pair< typename Traits::Point_2, Multiplicity > IntersectionResult; @@ -594,7 +602,6 @@ protected: return res; } - protected: Traits traits; Intersect_2 intersectCurves; @@ -606,17 +613,17 @@ class Arr_compute_y_at_x_2< CGAL::Arr_circular_arc_traits_2 > : { public: typedef CGAL::Arr_circular_arc_traits_2< CircularKernel > Traits; - typedef CircularKernel Kernel; - typedef typename Kernel::FT FT; - typedef typename Kernel::Root_of_2 Root_of_2; - typedef typename Kernel::Point_2 Point_2; - typedef typename Traits::Point_2 Arc_point_2; - typedef typename Kernel::Segment_2 Segment_2; - typedef typename Kernel::Line_arc_2 Line_arc_2; + typedef CircularKernel Kernel; + typedef typename Kernel::FT FT; + typedef typename Kernel::Root_of_2 Root_of_2; + typedef typename Kernel::Point_2 Point_2; + typedef typename Traits::Point_2 Arc_point_2; + typedef typename Kernel::Segment_2 Segment_2; + typedef typename Kernel::Line_arc_2 Line_arc_2; // Circular_arc_2 - typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; - typedef typename Traits::Intersect_2 Intersect_2; - typedef typename Traits::Multiplicity Multiplicity; + typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; + typedef typename Traits::Intersect_2 Intersect_2; + typedef typename Traits::Multiplicity Multiplicity; typedef std::pair< typename Traits::Point_2, Multiplicity > IntersectionResult; Arr_compute_y_at_x_2( ): @@ -674,11 +681,11 @@ class Arr_compute_y_at_x_2< CGAL::Arr_algebraic_segment_traits_2< public: typedef Coefficient_ Coefficient; typedef CGAL::Arr_algebraic_segment_traits_2< Coefficient > Traits; - typedef typename Traits::Algebraic_real_1 CoordinateType; - typedef typename Traits::Point_2 Point_2; - typedef typename Traits::Intersect_2 Intersect_2; - typedef typename Traits::Multiplicity Multiplicity; - typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; + typedef typename Traits::Algebraic_real_1 CoordinateType; + typedef typename Traits::Point_2 Point_2; + typedef typename Traits::Intersect_2 Intersect_2; + typedef typename Traits::Multiplicity Multiplicity; + typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; CoordinateType operator() ( const X_monotone_curve_2& curve, const CoordinateType& x ) @@ -749,17 +756,17 @@ class Construct_x_monotone_subcurve_2 { public: typedef typename ArrTraitsAdaptor< ArrTraits >::Kernel Kernel; - typedef typename ArrTraits::X_monotone_curve_2 X_monotone_curve_2; - typedef typename ArrTraits::Split_2 Split_2; - typedef typename ArrTraits::Intersect_2 Intersect_2; - typedef typename ArrTraits::Multiplicity Multiplicity; - typedef typename ArrTraits::Construct_min_vertex_2 Construct_min_vertex_2; - typedef typename ArrTraits::Construct_max_vertex_2 Construct_max_vertex_2; - typedef typename ArrTraits::Compare_x_2 Compare_x_2; - typedef typename Kernel::FT FT; + typedef typename ArrTraits::X_monotone_curve_2 X_monotone_curve_2; + typedef typename ArrTraits::Split_2 Split_2; + typedef typename ArrTraits::Intersect_2 Intersect_2; + typedef typename ArrTraits::Multiplicity Multiplicity; + typedef typename ArrTraits::Construct_min_vertex_2 Construct_min_vertex_2; + typedef typename ArrTraits::Construct_max_vertex_2 Construct_max_vertex_2; + typedef typename ArrTraits::Compare_x_2 Compare_x_2; + typedef typename Kernel::FT FT; typedef typename ArrTraitsAdaptor< ArrTraits >::CoordinateType CoordinateType; - typedef typename ArrTraits::Point_2 Point_2; - typedef typename Kernel::Point_2 Kernel_point_2; + typedef typename ArrTraits::Point_2 Point_2; + typedef typename Kernel::Point_2 Kernel_point_2; //typedef typename Kernel::Line_2 Line_2; //typedef typename Kernel::Compute_y_at_x_2 Compute_y_at_x_2; @@ -826,16 +833,16 @@ class Construct_x_monotone_subcurve_2< CGAL::Arr_circular_arc_traits_2< { public: typedef CGAL::Arr_circular_arc_traits_2< CircularKernel > ArrTraits; - typedef typename ArrTraits::Intersect_2 Intersect_2; - typedef typename ArrTraits::Split_2 Split_2; - typedef typename ArrTraits::Compare_x_2 Compare_x_2; - typedef typename ArrTraits::Construct_min_vertex_2 Construct_min_vertex_2; - typedef typename ArrTraits::Construct_max_vertex_2 Construct_max_vertex_2; - typedef typename ArrTraits::X_monotone_curve_2 X_monotone_curve_2; - typedef typename CircularKernel::Point_2 Non_arc_point_2; - typedef typename ArrTraits::Point_2 Arc_point_2; - typedef typename CircularKernel::FT FT; - typedef typename CircularKernel::Root_of_2 Root_of_2; + typedef typename ArrTraits::Intersect_2 Intersect_2; + typedef typename ArrTraits::Split_2 Split_2; + typedef typename ArrTraits::Compare_x_2 Compare_x_2; + typedef typename ArrTraits::Construct_min_vertex_2 Construct_min_vertex_2; + typedef typename ArrTraits::Construct_max_vertex_2 Construct_max_vertex_2; + typedef typename ArrTraits::X_monotone_curve_2 X_monotone_curve_2; + typedef typename CircularKernel::Point_2 Non_arc_point_2; + typedef typename ArrTraits::Point_2 Arc_point_2; + typedef typename CircularKernel::FT FT; + typedef typename CircularKernel::Root_of_2 Root_of_2; typedef typename CircularKernel::Root_for_circles_2_2 Root_for_circles_2_2; public: @@ -847,7 +854,9 @@ public: construct_max_vertex_2( this->traits.construct_max_vertex_2_object( ) ) { } - X_monotone_curve_2 operator() ( const X_monotone_curve_2& curve, const Arc_point_2& pLeft, const Arc_point_2& pRight ) + X_monotone_curve_2 operator() ( const X_monotone_curve_2& curve, + const Arc_point_2& pLeft, + const Arc_point_2& pRight ) { Arc_point_2 pMin = this->construct_min_vertex_2( curve ); Arc_point_2 pMax = this->construct_max_vertex_2( curve ); @@ -976,11 +985,11 @@ class Construct_x_monotone_subcurve_2< CGAL::Arr_algebraic_segment_traits_2< public: // typedefs typedef Coefficient_ Coefficient; typedef CGAL::Arr_algebraic_segment_traits_2< Coefficient > ArrTraits; - typedef typename ArrTraits::X_monotone_curve_2 X_monotone_curve_2; + typedef typename ArrTraits::X_monotone_curve_2 X_monotone_curve_2; typedef typename ArrTraitsAdaptor< ArrTraits >::Kernel Kernel; - typedef typename ArrTraits::Point_2 Point_2; + typedef typename ArrTraits::Point_2 Point_2; //typedef typename Kernel::Point_2 Point_2; - typedef typename Kernel::Segment_2 Segment_2; + typedef typename Kernel::Segment_2 Segment_2; public: // methods // curve can be unbounded. if curve is unbounded to the left, pLeft is a @@ -1010,8 +1019,7 @@ protected: }; // class SnapStrategy template < class ArrTraits > -SnapStrategy< ArrTraits >:: -SnapStrategy( QGraphicsScene* scene_ ) +SnapStrategy< ArrTraits >::SnapStrategy( QGraphicsScene* scene_ ) { this->scene = scene_; } @@ -1025,7 +1033,7 @@ public: typedef typename Kernel::Point_2 Kernel_point_2; typedef SnapStrategy< ArrTraits > Superclass; - SnapToGridStrategy( ): + SnapToGridStrategy( ) : Superclass( NULL ), gridSize( 50 ) { } @@ -1143,15 +1151,15 @@ class SnapToArrangementVertexStrategy: { public: typedef Arr_ Arrangement; - typedef typename Arrangement::Geometry_traits_2 Traits; - typedef typename ArrTraitsAdaptor< Traits >::Kernel Kernel; - typedef SnapStrategy< Traits > Superclass; - typedef typename Arrangement::Vertex_iterator Vertex_iterator; + typedef typename Arrangement::Geometry_traits_2 Traits; + typedef typename ArrTraitsAdaptor< Traits >::Kernel Kernel; + typedef SnapStrategy< Traits > Superclass; + typedef typename Arrangement::Vertex_iterator Vertex_iterator; typedef typename Kernel::Compute_squared_distance_2 Compute_squared_distance_2; - typedef typename Kernel::FT FT; - typedef typename Traits::Point_2 Point_2; - typedef typename Kernel::Point_2 Kernel_point_2; + typedef typename Kernel::FT FT; + typedef typename Traits::Point_2 Point_2; + typedef typename Kernel::Point_2 Kernel_point_2; SnapToArrangementVertexStrategy( ): Superclass( NULL ), @@ -1210,7 +1218,8 @@ public: } template < class CircularKernel > - Point_2 snapPoint( const Kernel_point_2& clickedPoint, CGAL::Arr_circular_arc_traits_2< CircularKernel > traits ) + Point_2 snapPoint( const Kernel_point_2& clickedPoint, + CGAL::Arr_circular_arc_traits_2< CircularKernel > traits ) { typedef Kernel_point_2 Non_arc_point_2; typedef typename CircularKernel::Circular_arc_point_2 Arc_point_2; @@ -1270,10 +1279,10 @@ protected: template < class ArrTraits > class Arr_construct_point_2 { - typedef typename ArrTraits::Point_2 Point_2; + typedef typename ArrTraits::Point_2 Point_2; typedef typename ArrTraitsAdaptor< ArrTraits >::CoordinateType CoordinateType; - typedef typename ArrTraitsAdaptor< ArrTraits >::Kernel Kernel; - typedef typename Kernel::Point_2 Kernel_point_2; + typedef typename ArrTraitsAdaptor< ArrTraits >::Kernel Kernel; + typedef typename Kernel::Point_2 Kernel_point_2; public: Point_2 operator()( const Kernel_point_2& pt ) @@ -1311,7 +1320,11 @@ protected: }; class Find_nearest_edge_base : public QGraphicsSceneMixin -{ }; +{ +public: + /*! Destructor (virtual) */ + ~Find_nearest_edge_base() {} +}; template < class Arr_, class ArrTraits = typename Arr_::Geometry_traits_2 > class Find_nearest_edge : public Find_nearest_edge_base @@ -1324,14 +1337,14 @@ public: // typedefs typedef CGAL::Arr_walk_along_line_point_location< Arrangement > Point_location_strategy; typedef typename ArrTraitsAdaptor< ArrTraits >::Kernel Kernel; - typedef typename Kernel::Point_2 Point_2; - typedef typename Arrangement::Face_const_handle Face_const_handle; - typedef typename Arrangement::Halfedge_const_handle Halfedge_const_handle; - typedef typename Arrangement::Vertex_const_handle Vertex_const_handle; + typedef typename Kernel::Point_2 Point_2; + typedef typename Arrangement::Face_const_handle Face_const_handle; + typedef typename Arrangement::Halfedge_const_handle Halfedge_const_handle; + typedef typename Arrangement::Vertex_const_handle Vertex_const_handle; typedef typename Arrangement::Ccb_halfedge_const_circulator Ccb_halfedge_const_circulator; typedef typename Point_curve_distance::FT FT; - typedef typename Arrangement::Hole_const_iterator Hole_const_iterator; + typedef typename Arrangement::Hole_const_iterator Hole_const_iterator; typedef typename Arrangement::Halfedge_around_vertex_const_circulator Halfedge_around_vertex_const_circulator; @@ -1467,20 +1480,20 @@ class Find_nearest_edge< Arr_, CGAL::Arr_linear_traits_2< Kernel_ > >: public Fi { public: // typedefs typedef Arr_ Arrangement; - typedef typename Arrangement::Geometry_traits_2 ArrTraits; - typedef Compute_squared_distance_2< ArrTraits > Point_curve_distance; - typedef typename ArrTraits::X_monotone_curve_2 X_monotone_curve_2; + typedef typename Arrangement::Geometry_traits_2 ArrTraits; + typedef Compute_squared_distance_2< ArrTraits > Point_curve_distance; + typedef typename ArrTraits::X_monotone_curve_2 X_monotone_curve_2; typedef CGAL::Arr_walk_along_line_point_location< Arrangement > Point_location_strategy; typedef typename ArrTraitsAdaptor< ArrTraits >::Kernel Kernel; typedef typename Kernel::Point_2 Point_2; - typedef typename Arrangement::Face_const_handle Face_const_handle; - typedef typename Arrangement::Halfedge_const_handle Halfedge_const_handle; - typedef typename Arrangement::Vertex_const_handle Vertex_const_handle; + typedef typename Arrangement::Face_const_handle Face_const_handle; + typedef typename Arrangement::Halfedge_const_handle Halfedge_const_handle; + typedef typename Arrangement::Vertex_const_handle Vertex_const_handle; typedef typename Arrangement::Ccb_halfedge_const_circulator Ccb_halfedge_const_circulator; typedef typename Point_curve_distance::FT FT; - typedef typename Arrangement::Hole_const_iterator Hole_const_iterator; + typedef typename Arrangement::Hole_const_iterator Hole_const_iterator; typedef typename Arrangement::Halfedge_around_vertex_const_circulator Halfedge_around_vertex_const_circulator; diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/VerticalRayShootCallback.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/VerticalRayShootCallback.h index febc12bb4c2..962249704f0 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/VerticalRayShootCallback.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/VerticalRayShootCallback.h @@ -59,46 +59,45 @@ protected: * * The template parameter is a CGAL::Arrangement_with_history_2 of some type. */ -template < class Arr_ > +template < typename Arr_ > class VerticalRayShootCallback : public VerticalRayShootCallbackBase { public: typedef VerticalRayShootCallbackBase Superclass; typedef Arr_ Arrangement; - typedef typename Arrangement::Halfedge_handle Halfedge_handle; - typedef typename Arrangement::Halfedge_const_handle Halfedge_const_handle; - typedef typename Arrangement::Halfedge_iterator Halfedge_iterator; - typedef typename Arrangement::Face_handle Face_handle; - typedef typename Arrangement::Face_const_handle Face_const_handle; - typedef typename Arrangement::Vertex_const_handle Vertex_const_handle; + typedef typename Arrangement::Halfedge_handle Halfedge_handle; + typedef typename Arrangement::Halfedge_const_handle Halfedge_const_handle; + typedef typename Arrangement::Halfedge_iterator Halfedge_iterator; + typedef typename Arrangement::Face_handle Face_handle; + typedef typename Arrangement::Face_const_handle Face_const_handle; + typedef typename Arrangement::Vertex_const_handle Vertex_const_handle; typedef typename Arrangement::Halfedge_around_vertex_const_circulator Halfedge_around_vertex_const_circulator; - typedef typename Arrangement::Geometry_traits_2 Traits; - typedef typename Arrangement::Curve_handle Curve_handle; + typedef typename Arrangement::Geometry_traits_2 Traits; + typedef typename Arrangement::Curve_handle Curve_handle; typedef typename Arrangement::Originating_curve_iterator Originating_curve_iterator; - typedef typename Arrangement::Induced_edge_iterator Induced_edge_iterator; + typedef typename Arrangement::Induced_edge_iterator Induced_edge_iterator; typedef typename Arrangement::Ccb_halfedge_const_circulator Ccb_halfedge_const_circulator; - typedef typename Arrangement::Hole_const_iterator Hole_const_iterator; - typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; - // typedef typename Traits::Construct_x_monotone_curve_2 Construct_x_monotone_curve_2; - typedef typename Traits::Intersect_2 Intersect_2; - typedef typename Traits::Multiplicity Multiplicity; - typedef typename ArrTraitsAdaptor< Traits >::Kernel Kernel; + typedef typename Arrangement::Hole_const_iterator Hole_const_iterator; + typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; + typedef typename Traits::Intersect_2 Intersect_2; + typedef typename Traits::Multiplicity Multiplicity; + typedef typename ArrTraitsAdaptor< Traits >::Kernel Kernel; typedef typename ArrTraitsAdaptor< Traits >::CoordinateType CoordinateType; - typedef typename Kernel::Point_2 Kernel_point_2; - typedef typename Traits::Point_2 Point_2; + typedef typename Kernel::Point_2 Kernel_point_2; + typedef typename Traits::Point_2 Point_2; typedef std::pair< typename Traits::Point_2, Multiplicity > - IntersectionResult; - typedef typename Kernel::Segment_2 Segment_2; - typedef typename Kernel::FT FT; + IntersectionResult; + typedef typename Kernel::Segment_2 Segment_2; + typedef typename Kernel::FT FT; typedef typename CGAL::Arr_trapezoid_ric_point_location< Arrangement > TrapezoidPointLocationStrategy; typedef typename CGAL::Arr_simple_point_location< Arrangement > SimplePointLocationStrategy; typedef typename CGAL::Arr_walk_along_line_point_location< Arrangement > - WalkAlongLinePointLocationStrategy; + Walk_pl_strategy; typedef typename CGAL::Arr_landmarks_point_location< Arrangement > LandmarksPointLocationStrategy; @@ -142,7 +141,6 @@ protected: using Superclass::shootingUp; Traits traits; Arrangement* arr; - //Construct_x_monotone_curve_2 construct_x_monotone_curve_2; Intersect_2 intersectCurves; CGAL::Qt::Converter< Kernel > convert; CGAL::Object pointLocationStrategy; @@ -153,14 +151,13 @@ protected: VerticalRayGraphicsItem rayGraphicsItem; }; // class VerticalRayShootCallback -template < class Arr_ > +template < typename Arr_ > VerticalRayShootCallback< Arr_ >:: VerticalRayShootCallback( Arrangement* arr_, QObject* parent_ ): VerticalRayShootCallbackBase( parent_ ), arr( arr_ ), - // construct_x_monotone_curve_2( this->traits.construct_x_monotone_curve_2_object( ) ), intersectCurves( this->traits.intersect_2_object( ) ), - pointLocationStrategy( CGAL::make_object( new WalkAlongLinePointLocationStrategy( *arr_ ) ) ), + pointLocationStrategy( CGAL::make_object( new Walk_pl_strategy( *arr_ ) ) ), highlightedCurves( new CGAL::Qt::CurveGraphicsItem< Traits >( ) ), activeRay( new QGraphicsLineItem ) { @@ -176,7 +173,7 @@ VerticalRayShootCallback( Arrangement* arr_, QObject* parent_ ): this, SLOT( slotModelChanged( ) ) ); } -template < class Arr_ > +template < typename Arr_ > void VerticalRayShootCallback< Arr_ >::setScene( QGraphicsScene* scene_ ) { this->scene = scene_; @@ -190,13 +187,13 @@ void VerticalRayShootCallback< Arr_ >::setScene( QGraphicsScene* scene_ ) } -template < class Arr_ > +template < typename Arr_ > void VerticalRayShootCallback< Arr_ >::slotModelChanged( ) { this->activeRay->update( ); } -template < class Arr_ > +template < typename Arr_ > void VerticalRayShootCallback< Arr_ >::reset( ) { this->activeRay->setLine( 0, 0, 0, 0 ); @@ -205,19 +202,19 @@ void VerticalRayShootCallback< Arr_ >::reset( ) emit modelChanged( ); } -template < class Arr_ > +template < typename Arr_ > void VerticalRayShootCallback< Arr_ >:: mousePressEvent( QGraphicsSceneMouseEvent* event ) { this->highlightPointLocation( event ); } -template < class Arr_ > +template < typename Arr_ > void VerticalRayShootCallback< Arr_ >:: mouseMoveEvent( QGraphicsSceneMouseEvent* event ) { } -template < class Arr_ > +template < typename Arr_ > void VerticalRayShootCallback< Arr_ >:: highlightPointLocation( QGraphicsSceneMouseEvent* event ) { @@ -291,7 +288,7 @@ highlightPointLocation( QGraphicsSceneMouseEvent* event ) emit modelChanged( ); } -template < class Arr_ > +template < typename Arr_ > typename VerticalRayShootCallback< Arr_ >::Face_const_handle VerticalRayShootCallback< Arr_ >::getFace( const CGAL::Object& obj ) { @@ -312,12 +309,12 @@ VerticalRayShootCallback< Arr_ >::getFace( const CGAL::Object& obj ) return (eit->face( )); } -template < class Arr_ > +template < typename Arr_ > CGAL::Object VerticalRayShootCallback< Arr_ >::rayShootUp( const Kernel_point_2& pt ) { CGAL::Object pointLocationResult; - WalkAlongLinePointLocationStrategy* walkStrategy; + Walk_pl_strategy* walkStrategy; TrapezoidPointLocationStrategy* trapezoidStrategy; SimplePointLocationStrategy* simpleStrategy; LandmarksPointLocationStrategy* landmarksStrategy; @@ -345,12 +342,12 @@ VerticalRayShootCallback< Arr_ >::rayShootUp( const Kernel_point_2& pt ) return pointLocationResult; } -template < class Arr_ > +template < typename Arr_ > CGAL::Object VerticalRayShootCallback< Arr_ >::rayShootDown( const Kernel_point_2& pt ) { CGAL::Object pointLocationResult; - WalkAlongLinePointLocationStrategy* walkStrategy; + Walk_pl_strategy* walkStrategy; TrapezoidPointLocationStrategy* trapezoidStrategy; SimplePointLocationStrategy* simpleStrategy; LandmarksPointLocationStrategy* landmarksStrategy;