diff --git a/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar1.C b/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar1.C deleted file mode 100644 index f5342eb753f..00000000000 --- a/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar1.C +++ /dev/null @@ -1,90 +0,0 @@ -// ============================================================================ -// -// Copyright (c) 1997-2000 The CGAL Consortium -// -// This software and related documentation is part of an INTERNAL release -// of the Computational Geometry Algorithms Library (CGAL). It is not -// intended for general use. -// -// ---------------------------------------------------------------------------- -// -// file : demo/Qt_widget/Max_k-gon/Qt_widget_toolbar.C -// package : Qt_widget -// author(s) : Radu Ursu -// release : -// release_date : -// -// coordinator : Laurent Rineau -// -// ============================================================================ - -#ifdef CGAL_USE_QT - -#include -#include "Qt_widget_toolbar1.h" - -// icons -#include -#include -#include -#include - -#include - -Tools_toolbar::Tools_toolbar(CGAL::Qt_widget *w, - QMainWindow *mw, std::list *l1) : - QToolBar(mw, "NT") - { -// w->attach(&move_deletebut); - w->attach(&pointbut); - w->attach(&segmentbut); - -// move_deletebut.deactivate(); - pointbut.deactivate(); - segmentbut.deactivate(); - -// move_deletebut.pass_the_structure(l1); - //set the widget - widget = w; - - QIconSet set0(QPixmap( (const char**)arrow_small_xpm ), - QPixmap( (const char**)arrow_xpm )); - QIconSet set1(QPixmap( (const char**)point_small_xpm ), - QPixmap( (const char**)point_xpm )); -// QIconSet set2(QPixmap( (const char**)movepoint_small_xpm ), -// QPixmap( (const char**)movepoint_xpm )); - QIconSet set2(QPixmap( (const char**)line_small_xpm ), - QPixmap( (const char**)line_xpm )); - - but[0] = new QToolButton(this, "deactivate layer"); - but[0]->setIconSet(set0); - but[0]->setTextLabel("Deactivate Layer"); - but[1] = new QToolButton(this, "pointinput layer"); - but[1]->setIconSet(set1); - but[1]->setTextLabel("Input point"); -// but[2] = new QToolButton(this, "move/delete layer"); -// but[2]->setIconSet(set2); -// but[2]->setTextLabel("Move/Delete Point"); - but[2] = new QToolButton(this, "segment layer"); - but[2]->setIconSet(set2); - but[2]->setTextLabel("Segment layer"); - - nr_of_buttons = 3; - button_group = new QButtonGroup(0, "My_group"); - for(int i = 0; iinsert(but[i]); - but[i]->setToggleButton(true); - } - button_group->setExclusive(true); - - connect(but[1], SIGNAL(stateChanged(int)), - &pointbut, SLOT(stateChanged(int))); -// connect(but[2], SIGNAL(stateChanged(int)), -// &move_deletebut, SLOT(stateChanged(int))); - connect(but[2], SIGNAL(stateChanged(int)), - &segmentbut, SLOT(stateChanged(int))); -}; - -#include "Qt_widget_toolbar1.moc" - -#endif diff --git a/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar1.h b/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar1.h deleted file mode 100644 index c0c6b51124a..00000000000 --- a/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar1.h +++ /dev/null @@ -1,85 +0,0 @@ -// ============================================================================ -// -// Copyright (c) 1997-2000 The CGAL Consortium - -// This software and related documentation are part of the Computational -// Geometry Algorithms Library (CGAL). -// This software and documentation are provided "as-is" and without warranty -// of any kind. In no event shall the CGAL Consortium be liable for any -// damage of any kind. -// -// Every use of CGAL requires a license. -// -// Academic research and teaching license -// - For academic research and teaching purposes, permission to use and copy -// the software and its documentation is hereby granted free of charge, -// provided that it is not a component of a commercial product, and this -// notice appears in all copies of the software and related documentation. -// -// Commercial licenses -// - Please check the CGAL web site http://www.cgal.org/index2.html for -// availability. -// -// The CGAL Consortium consists of Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbrucken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). -// -// ---------------------------------------------------------------------- -// -// file : demo/Qt_widget/Max_k-gon/Qt_widget_toolbar.h -// package : Qt_widget -// author(s) : Ursu Radu -// release : CGAL-2.4 -// release_date : 2002, May 16 -// -// coordinator : Laurent Rineau -// -// email : contact@cgal.org -// www : http://www.cgal.org -// -// ====================================================================== - - -#ifndef CGAL_QT_WIDGET_TOOLBAR_H -#define CGAL_QT_WIDGET_TOOLBAR_H - -#include "cgal_types1.h" - -// TODO: check if some of those includes shouldn't be in the .C file -#include -#include -#include - -#include -#include -#include -#include -#include - - -typedef CGAL::Quotient Cd; -typedef CGAL::Cartesian RP; -class Tools_toolbar : public QToolBar -{ - Q_OBJECT -public: - Tools_toolbar(CGAL::Qt_widget *w, QMainWindow *mw, std::list *l1); - ~Tools_toolbar(){}; - -signals: - void new_object(CGAL::Object); - -private: - QToolButton *but[10]; - QButtonGroup *button_group; - CGAL::Qt_widget *widget; - int nr_of_buttons; - - CGAL::Qt_widget_get_point pointbut; - CGAL::Qt_widget_get_segment segmentbut; -// Qt_widget_move_list_point move_deletebut; -};//end class - -#endif diff --git a/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar2.C b/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar2.C deleted file mode 100644 index 5c3bd508325..00000000000 --- a/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar2.C +++ /dev/null @@ -1,80 +0,0 @@ -// ============================================================================ -// -// Copyright (c) 1997-2000 The CGAL Consortium -// -// This software and related documentation is part of an INTERNAL release -// of the Computational Geometry Algorithms Library (CGAL). It is not -// intended for general use. -// -// ---------------------------------------------------------------------------- -// -// file : demo/Qt_widget/Max_k-gon/Qt_widget_toolbar.C -// package : Qt_widget -// author(s) : Radu Ursu -// release : -// release_date : -// -// coordinator : Laurent Rineau -// -// ============================================================================ - -#ifdef CGAL_USE_QT - -#include -#include "Qt_widget_toolbar2.h" - -// icons -#include -#include -#include - -#include - -Tools_toolbar::Tools_toolbar(CGAL::Qt_widget *w, - QMainWindow *mw, std::list *l1) : - QToolBar(mw, "NT") - { -// w->attach(&move_deletebut); - w->attach(&polygonbut); - -// move_deletebut.deactivate(); - polygonbut.deactivate(); - -// move_deletebut.pass_the_structure(l1); - //set the widget - widget = w; - - QIconSet set0(QPixmap( (const char**)arrow_small_xpm ), - QPixmap( (const char**)arrow_xpm )); -// QIconSet set2(QPixmap( (const char**)movepoint_small_xpm ), -// QPixmap( (const char**)movepoint_xpm )); - QIconSet set1(QPixmap( (const char**)polygon_small_xpm ), - QPixmap( (const char**)polygon_xpm )); - - but[0] = new QToolButton(this, "deactivate layer"); - but[0]->setIconSet(set0); - but[0]->setTextLabel("Deactivate Layer"); -// but[2] = new QToolButton(this, "move/delete layer"); -// but[2]->setIconSet(set2); -// but[2]->setTextLabel("Move/Delete Point"); - but[1] = new QToolButton(this, "polygon layer"); - but[1]->setIconSet(set1); - but[1]->setTextLabel("Polygon layer"); - - nr_of_buttons = 2; - button_group = new QButtonGroup(0, "My_group"); - for(int i = 0; iinsert(but[i]); - but[i]->setToggleButton(true); - } - button_group->setExclusive(true); - -// connect(but[2], SIGNAL(stateChanged(int)), -// &move_deletebut, SLOT(stateChanged(int))); - connect(but[1], SIGNAL(stateChanged(int)), - &polygonbut, SLOT(stateChanged(int))); -}; - -#include "Qt_widget_toolbar2.moc" - -#endif diff --git a/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar2.h b/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar2.h deleted file mode 100644 index 2999ece485e..00000000000 --- a/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar2.h +++ /dev/null @@ -1,82 +0,0 @@ -// ============================================================================ -// -// Copyright (c) 1997-2000 The CGAL Consortium - -// This software and related documentation are part of the Computational -// Geometry Algorithms Library (CGAL). -// This software and documentation are provided "as-is" and without warranty -// of any kind. In no event shall the CGAL Consortium be liable for any -// damage of any kind. -// -// Every use of CGAL requires a license. -// -// Academic research and teaching license -// - For academic research and teaching purposes, permission to use and copy -// the software and its documentation is hereby granted free of charge, -// provided that it is not a component of a commercial product, and this -// notice appears in all copies of the software and related documentation. -// -// Commercial licenses -// - Please check the CGAL web site http://www.cgal.org/index2.html for -// availability. -// -// The CGAL Consortium consists of Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbrucken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). -// -// ---------------------------------------------------------------------- -// -// file : demo/Qt_widget/Max_k-gon/Qt_widget_toolbar.h -// package : Qt_widget -// author(s) : Ursu Radu -// release : CGAL-2.4 -// release_date : 2002, May 16 -// -// coordinator : Laurent Rineau -// -// email : contact@cgal.org -// www : http://www.cgal.org -// -// ====================================================================== - - -#ifndef CGAL_QT_WIDGET_TOOLBAR_H -#define CGAL_QT_WIDGET_TOOLBAR_H - -#include "cgal_types2.h" - -// TODO: check if some of those includes shouldn't be in the .C file -#include -#include - -#include -#include -#include -#include -#include - - -typedef CGAL::Quotient Cd; -typedef CGAL::Cartesian RP; -class Tools_toolbar : public QToolBar -{ - Q_OBJECT -public: - Tools_toolbar(CGAL::Qt_widget *w, QMainWindow *mw, std::list *l1); - ~Tools_toolbar(){}; - -signals: - void new_object(CGAL::Object); - -private: - QToolButton *but[9]; - QButtonGroup *button_group; - CGAL::Qt_widget *widget; - int nr_of_buttons; - - CGAL::Qt_widget_get_polygon polygonbut; -};//end class - -#endif diff --git a/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar3.C b/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar3.C deleted file mode 100644 index e7bc9125a79..00000000000 --- a/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar3.C +++ /dev/null @@ -1,90 +0,0 @@ -// ============================================================================ -// -// Copyright (c) 1997-2000 The CGAL Consortium -// -// This software and related documentation is part of an INTERNAL release -// of the Computational Geometry Algorithms Library (CGAL). It is not -// intended for general use. -// -// ---------------------------------------------------------------------------- -// -// file : demo/Qt_widget/Max_k-gon/Qt_widget_toolbar.C -// package : Qt_widget -// author(s) : Radu Ursu -// release : -// release_date : -// -// coordinator : Laurent Rineau -// -// ============================================================================ - -#ifdef CGAL_USE_QT - -#include -#include "Qt_widget_toolbar3.h" - -// icons -#include -#include -#include "polyline.xpm" -#include - -#include - -Tools_toolbar::Tools_toolbar(CGAL::Qt_widget *w, - QMainWindow *mw, std::list *l1) : - QToolBar(mw, "NT") - { -// w->attach(&move_deletebut); - w->attach(&pointbut); - w->attach(&polygonbut); - -// move_deletebut.deactivate(); - pointbut.deactivate(); - polygonbut.deactivate(); - -// move_deletebut.pass_the_structure(l1); - //set the widget - widget = w; - - QIconSet set0(QPixmap( (const char**)arrow_small_xpm ), - QPixmap( (const char**)arrow_xpm )); - QIconSet set1(QPixmap( (const char**)point_small_xpm ), - QPixmap( (const char**)point_xpm )); -// QIconSet set2(QPixmap( (const char**)movepoint_small_xpm ), -// QPixmap( (const char**)movepoint_xpm )); - QIconSet set2(QPixmap( (const char**)polyline_small_xpm ), - QPixmap( (const char**)polyline_xpm )); - - but[0] = new QToolButton(this, "deactivate layer"); - but[0]->setIconSet(set0); - but[0]->setTextLabel("Deactivate Layer"); - but[1] = new QToolButton(this, "pointinput layer"); - but[1]->setIconSet(set1); - but[1]->setTextLabel("Input point"); -// but[2] = new QToolButton(this, "move/delete layer"); -// but[2]->setIconSet(set2); -// but[2]->setTextLabel("Move/Delete Point"); - but[2] = new QToolButton(this, "polygon layer"); - but[2]->setIconSet(set2); - but[2]->setTextLabel("Polygon layer"); - - nr_of_buttons = 3; - button_group = new QButtonGroup(0, "My_group"); - for(int i = 0; iinsert(but[i]); - but[i]->setToggleButton(true); - } - button_group->setExclusive(true); - - connect(but[1], SIGNAL(stateChanged(int)), - &pointbut, SLOT(stateChanged(int))); -// connect(but[2], SIGNAL(stateChanged(int)), -// &move_deletebut, SLOT(stateChanged(int))); - connect(but[2], SIGNAL(stateChanged(int)), - &polygonbut, SLOT(stateChanged(int))); -}; - -#include "Qt_widget_toolbar3.moc" - -#endif diff --git a/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar3.h b/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar3.h deleted file mode 100644 index a854e5f707e..00000000000 --- a/Packages/Arrangement/demo/Qt_window/Qt_widget_toolbar3.h +++ /dev/null @@ -1,86 +0,0 @@ -// ============================================================================ -// -// Copyright (c) 1997-2000 The CGAL Consortium - -// This software and related documentation are part of the Computational -// Geometry Algorithms Library (CGAL). -// This software and documentation are provided "as-is" and without warranty -// of any kind. In no event shall the CGAL Consortium be liable for any -// damage of any kind. -// -// Every use of CGAL requires a license. -// -// Academic research and teaching license -// - For academic research and teaching purposes, permission to use and copy -// the software and its documentation is hereby granted free of charge, -// provided that it is not a component of a commercial product, and this -// notice appears in all copies of the software and related documentation. -// -// Commercial licenses -// - Please check the CGAL web site http://www.cgal.org/index2.html for -// availability. -// -// The CGAL Consortium consists of Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbrucken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). -// -// ---------------------------------------------------------------------- -// -// file : demo/Qt_widget/Max_k-gon/Qt_widget_toolbar.h -// package : Qt_widget -// author(s) : Ursu Radu -// release : CGAL-2.4 -// release_date : 2002, May 16 -// -// coordinator : Laurent Rineau -// -// email : contact@cgal.org -// www : http://www.cgal.org -// -// ====================================================================== - - -#ifndef CGAL_QT_WIDGET_TOOLBAR_H -#define CGAL_QT_WIDGET_TOOLBAR_H - -#include "cgal_types3.h" - -// TODO: check if some of those includes shouldn't be in the .C file -#include -#include -#include -//#include "Qt_widget_move_list_point.h" - -#include -#include -#include -#include -#include - - -typedef CGAL::Quotient Cd; -typedef CGAL::Cartesian RP; -class Tools_toolbar : public QToolBar -{ - Q_OBJECT -public: - Tools_toolbar(CGAL::Qt_widget *w, QMainWindow *mw, std::list *l1); - ~Tools_toolbar(){}; - -signals: - void new_object(CGAL::Object); - -private: - QToolButton *but[10]; - QButtonGroup *button_group; - CGAL::Qt_widget *widget; - int nr_of_buttons; - - CGAL::Qt_widget_get_point pointbut; - CGAL::Qt_widget_get_polygon polygonbut; -// Qt_widget_move_list_point move_deletebut; -};//end class - -#endif diff --git a/Packages/Arrangement/demo/Qt_window/cgal_types1.h b/Packages/Arrangement/demo/Qt_window/cgal_types1.h deleted file mode 100644 index 151942e6f5f..00000000000 --- a/Packages/Arrangement/demo/Qt_window/cgal_types1.h +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -//#include - -#include -#include -#include -#include -#include -#include - - -typedef CGAL::Quotient Coord_type; -typedef CGAL::Cartesian Rep; - -typedef Rep::Point_2 Point; -typedef Rep::Segment_2 Segment; -//typedef Rep::Iso_rectangle_2 Iso_rectangle_2; - - -typedef CGAL::Quotient NT; -typedef CGAL::Cartesian Kernel; -typedef CGAL::Arr_segment_traits_2 Traits; - -//typedef Traits::Point_2 Point; -typedef Traits::Curve_2 Curve; -typedef Traits::X_monotone_curve_2 X_curve; - -typedef CGAL::Arr_2_default_dcel Dcel; -//typedef CGAL::Planar_map_2 Pm; -//typedef CGAL::Planar_map_with_intersections_2 Pmwx; -typedef CGAL::Arr_base_node Base_node; -typedef CGAL::Arrangement_2 Arr; diff --git a/Packages/Arrangement/demo/Qt_window/cgal_types2.h b/Packages/Arrangement/demo/Qt_window/cgal_types2.h deleted file mode 100644 index 0a7ebcc957e..00000000000 --- a/Packages/Arrangement/demo/Qt_window/cgal_types2.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef CGAL_TYPES_HEADER -#define CGAL_TYPES_HEADER - -#include -#include -#include -//#include - -#include -#include -#include -#include -#include -#include -#include - -typedef CGAL::Quotient Coord_type; -typedef CGAL::Cartesian Rep; - -typedef Rep::Point_2 Point; -typedef Rep::Segment_2 Segment; -//typedef Rep::Iso_rectangle_2 Iso_rectangle_2; - - -typedef CGAL::Quotient NT; -typedef CGAL::Cartesian Kernel; -typedef CGAL::Arr_segment_traits_2 Traits; - -//typedef Traits::Point_2 Point; -typedef Traits::Curve_2 Curve; -typedef Traits::X_monotone_curve_2 X_curve; - -//a face with a counter for overlapping polygons (counter is initialized to -1) -struct Face_with_counter : public CGAL::Arr_2_face_base { - Face_with_counter() : CGAL::Arr_2_face_base(), counter(-1) {} - int counter; -}; - -typedef CGAL::Arr_base_node Base_node; - -//a DCEL with Face_with_counter -typedef CGAL::Pm_dcel, - CGAL::Arr_2_halfedge_base, - Face_with_counter > Dcel; - - -//typedef CGAL::Arr_2_default_dcel Dcel; -//typedef CGAL::Planar_map_2 Pm; -//typedef CGAL::Planar_map_with_intersections_2 Pmwx; - -typedef CGAL::Arrangement_2 Arr; - -typedef CGAL::Polygon_traits_2 PT; -typedef std::vector Container; -typedef CGAL::Polygon_2 Cgal_Polygon; - -#endif diff --git a/Packages/Arrangement/demo/Qt_window/cgal_types3.h b/Packages/Arrangement/demo/Qt_window/cgal_types3.h deleted file mode 100644 index 1a98f1fb0a6..00000000000 --- a/Packages/Arrangement/demo/Qt_window/cgal_types3.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef CGAL_TYPES_HEADER -#define CGAL_TYPES_HEADER - -#include -#include -#include -//#include - -#include -#include -#include -#include -#include -#include -#include -#include - -typedef CGAL::Quotient Coord_type; -typedef CGAL::Cartesian Rep; - -typedef Rep::Point_2 Point; -typedef Rep::Segment_2 Segment; -//typedef Rep::Iso_rectangle_2 Iso_rectangle_2; - - -typedef CGAL::Quotient NT; -typedef CGAL::Cartesian Kernel; -typedef CGAL::Arr_segment_traits_2 Seg_traits; -typedef CGAL::Arr_polyline_traits_2 Traits; - -//typedef Traits::Point_2 Point; -typedef Seg_traits::Curve_2 Curve; -typedef Seg_traits::X_monotone_curve_2 X_curve; - -typedef CGAL::Arr_2_default_dcel Dcel; -typedef CGAL::Arr_base_node Base_node; -typedef CGAL::Arrangement_2 Arr; - -typedef CGAL::Polygon_traits_2 PT; -typedef std::vector Container; -typedef CGAL::Polygon_2 Cgal_Polygon; - -#endif diff --git a/Packages/Arrangement/demo/Qt_window/demo1.C b/Packages/Arrangement/demo/Qt_window/demo1.C deleted file mode 100644 index 3f10ffe735a..00000000000 --- a/Packages/Arrangement/demo/Qt_window/demo1.C +++ /dev/null @@ -1,366 +0,0 @@ -// ============================================================================ -// -// Copyright (c) 1997-2003 The CGAL Consortium -// This software and related documentation are part of the Computational -// Geometry Algorithms Library (CGAL). -// This software and documentation are provided "as-is" and without warranty -// of any kind. In no event shall the CGAL Consortium be liable for any -// damage of any kind. -// ---------------------------------------------------------------------- -// -// file : main.C -// package : Qt_widget -// author(s) : Radu Ursu -// coordinator : Laurent Rineau -// -// email : contact@cgal.org -// www : http://www.cgal.org -// -// ====================================================================== - - -// if QT is not installed, a message will be issued in runtime. -#ifndef CGAL_USE_QT -#include -int main(int, char*) -{ - - std::cout << "Sorry, this demo needs QT..."; - std::cout << std::endl; - - return 0; -} - -#else - -#include "cgal_types1.h" - -#include -#include -#include -#include -#include - - -#include -#include -#include "Qt_widget_toolbar1.h" -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -const QString my_title_string("Arrangement Demo with" - " CGAL Qt_widget"); - -//global flags and variables -int current_state; -std::list list_of_segments; -Arr arr; -bool pl_valid=false; -Point pl_point; - -class Qt_layer_show_ch : public CGAL::Qt_widget_layer -{ -public: - - Qt_layer_show_ch(){}; - - - void draw() - { - widget->lock(); - - *widget << CGAL::GREEN; - *widget << CGAL::LineWidth(1); - std::list::iterator itp = list_of_segments.begin(); - while(itp!=list_of_segments.end()){ - *widget << (*itp++); - } - - if(pl_valid && !(arr.halfedges_begin() == arr.halfedges_end()) ) - { - *widget << CGAL::LineWidth(3); - *widget << CGAL::YELLOW; - - Arr::Locate_type lt; - Arr::Point temp_p(pl_point.x(),pl_point.y()); - Arr::Halfedge_handle e = arr.locate(temp_p, lt); -// std::cout << "locate type " << lt << std::endl; - - //color the face on the screen - Arr::Face_handle f=e->face(); - - - if (f->does_outer_ccb_exist()) - { - Arr::Ccb_halfedge_circulator cc=f->outer_ccb(); - do { - *widget << cc->curve(); - } while (++cc != f->outer_ccb()); - - } - - Arr::Holes_iterator hit=f->holes_begin(),eit=f->holes_end(); - for (;hit!=eit; ++hit) - { - Arr::Ccb_halfedge_circulator cc=*hit; - do - { - *widget << cc->curve(); - } while (++cc != *hit); - } - *widget << CGAL::LineWidth(1); - } - - widget->unlock(); - }; - - void mousePressEvent(QMouseEvent *e) - { - if(e->button() == Qt::RightButton) - { - if( list_of_segments.empty() ) - return; - - NT x=static_cast(widget->x_real(e->x())); - NT y=static_cast(widget->y_real(e->y())); - - Point p(x,y); - NT min_dist=100000000; - std::list::iterator itp = list_of_segments.begin(); - std::list::iterator it_seg=NULL; - while(itp!=list_of_segments.end()) - { - NT dist = squared_distance( p, (*itp)); - if( dist < min_dist) - { - min_dist = dist; - it_seg = itp; - } - itp++; - } - - - Arr::Curve_iterator ci = arr.curve_node_begin(); - while(ci != arr.curve_node_end() ) - { - if( (*ci).curve() == - (*it_seg) ) - { - arr.remove_curve( ci ); - break; - } - ci++; - } - - list_of_segments.erase( it_seg ); - - pl_valid = false; - (*widget).redraw(); - } - }; - -};//end class - -class MyWindow : public QMainWindow -{ - Q_OBJECT -public: - MyWindow(int w, int h){ - widget = new CGAL::Qt_widget(this); - setCentralWidget(widget); - - //create a timer for checking if somthing changed - QTimer *timer = new QTimer( this ); - connect( timer, SIGNAL(timeout()), - this, SLOT(timer_done()) ); - timer->start( 200, FALSE ); - - // file menu - QPopupMenu * file = new QPopupMenu( this ); - menuBar()->insertItem( "&File", file ); - file->insertItem("&New", this, SLOT(new_instance()), CTRL+Key_N); - file->insertItem("New &Window", this, SLOT(new_window()), CTRL+Key_W); - file->insertSeparator(); - file->insertItem("Print", widget, SLOT(print_to_ps()), CTRL+Key_P); - file->insertSeparator(); - file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_X ); - file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q ); - - // drawing menu - QPopupMenu * draw = new QPopupMenu( this ); - menuBar()->insertItem( "&Draw", draw ); - draw->insertItem("&Generate segments", this, - SLOT(gen_segments()), CTRL+Key_G ); - - // help menu - QPopupMenu * help = new QPopupMenu( this ); - menuBar()->insertItem( "&Help", help ); - help->insertItem("How To", this, SLOT(howto()), Key_F1); - help->insertSeparator(); - help->insertItem("&About", this, SLOT(about()), CTRL+Key_A ); - help->insertItem("About &Qt", this, SLOT(aboutQt()) ); - - //the standard toolbar - stoolbar = new CGAL::Qt_widget_standard_toolbar (widget, this, "ST"); - //the new tools toolbar - newtoolbar = new Tools_toolbar(widget, this, &list_of_segments); - - *widget << CGAL::LineWidth(2) << CGAL::BackgroundColor (CGAL::BLACK); - - resize(w,h); - widget->set_window(-1, 1, -1, 1); - widget->setMouseTracking(TRUE); - - //connect the widget to the main function that receives the objects - connect(widget, SIGNAL(new_cgal_object(CGAL::Object)), - this, SLOT(get_new_object(CGAL::Object))); - - //application flag stuff - old_state = 0; - - //layers - widget->attach(&testlayer); - - }; - -private: - void something_changed(){current_state++;}; - -public slots: - void new_instance() - { - widget->lock(); - list_of_segments.clear(); - stoolbar->clear_history(); - widget->set_window(-1.1, 1.1, -1.1, 1.1); - // set the Visible Area to the Interval - widget->unlock(); - something_changed(); - } - -private slots: - void get_new_object(CGAL::Object obj) - { - pl_valid = false; - - Segment s; - if(CGAL::assign(s,obj)) { - list_of_segments.push_back(s); - arr.insert(s); - something_changed(); - } - - Point p; - if(CGAL::assign(p,obj)) { - - pl_point = p; - pl_valid = true; - - something_changed(); - } - - }; - - void about() - { - QMessageBox::about( this, my_title_string, - "This is a demo for the Arrangement package\n" - "Copyright CGAL @2003"); - }; - - void aboutQt() - { - QMessageBox::aboutQt( this, my_title_string ); - } - - void howto(){ - QString home; - home = "help/index.html"; - HelpWindow *help = new HelpWindow(home, ".", 0, "help viewer"); - help->resize(400, 400); - help->setCaption("Demo HowTo"); - help->show(); - } - - void new_window(){ - MyWindow *ed = new MyWindow(500, 500); - ed->setCaption("Layer"); - ed->stoolbar->clear_history(); - ed->widget->set_window(-1.1, 1.1, -1.1, 1.1); - ed->show(); - something_changed(); - } - - void timer_done() - { - if(old_state!=current_state){ - widget->redraw(); - old_state = current_state; - } - } - - void gen_segments() - { - stoolbar->clear_history(); - widget->set_window(-1.1, 1.1, -1.1, 1.1); - // set the Visible Area to the Interval - - // send resizeEvent only on show. - CGAL::Random_points_in_square_2 g(0.5); - for(int count=0; count<25; count++) - { - Point p1(*g++), p2(*g++); - NT scale(2); - Segment s( Point(p1.x()*scale,p1.y()*scale) , Point(p2.x()*scale,p2.y()*scale) ); - list_of_segments.push_back(s); - arr.insert(s); - } - - pl_valid = false; - - something_changed(); - } - - -private: - CGAL::Qt_widget *widget; - CGAL::Qt_widget_standard_toolbar - *stoolbar; - Tools_toolbar *newtoolbar; - int old_state; - Qt_layer_show_ch testlayer; -}; - -#include "demo1.moc" - - -int -main(int argc, char **argv) -{ - QApplication app( argc, argv ); - MyWindow widget(500,500); // physical window size - app.setMainWidget(&widget); - widget.setCaption(my_title_string); - widget.setMouseTracking(TRUE); - widget.show(); - current_state = -1; - return app.exec(); -} - -#endif // CGAL_USE_QT diff --git a/Packages/Arrangement/demo/Qt_window/demo2.C b/Packages/Arrangement/demo/Qt_window/demo2.C deleted file mode 100644 index 701305e0be3..00000000000 --- a/Packages/Arrangement/demo/Qt_window/demo2.C +++ /dev/null @@ -1,532 +0,0 @@ -// ============================================================================ -// -// Copyright (c) 1997-2003 The CGAL Consortium -// This software and related documentation are part of the Computational -// Geometry Algorithms Library (CGAL). -// This software and documentation are provided "as-is" and without warranty -// of any kind. In no event shall the CGAL Consortium be liable for any -// damage of any kind. -// ---------------------------------------------------------------------- -// -// file : main.C -// package : Qt_widget -// author(s) : Radu Ursu -// coordinator : Laurent Rineau -// -// email : contact@cgal.org -// www : http://www.cgal.org -// -// ====================================================================== - - -// if QT is not installed, a message will be issued in runtime. -#ifndef CGAL_USE_QT -#include -int main(int, char*) -{ - - std::cout << "Sorry, this demo needs QT..."; - std::cout << std::endl; - - return 0; -} - -#else - -#include "cgal_types2.h" - -#include -#include -#include -#include -#include - - -#include -#include -#include "Qt_widget_toolbar2.h" -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -const QString my_title_string("Arrangement Demo with" - " CGAL Qt_widget"); - -typedef std::list Polygon_list; -typedef std::list Segment_list; - -//global flags and variables -int current_state; -Polygon_list list_of_polygons; -Arr arr; - -Polygon_list list_of_covering; -Segment_list list_of_segments; - -// function declaration -bool polygons_covering(Polygon_list &in_poly_list, - Polygon_list &out_poly_list, bool intersection); - - -class Qt_layer_show_ch : public CGAL::Qt_widget_layer -{ -public: - - Qt_layer_show_ch(){}; - - - void draw() - { - widget->lock(); - - *widget << CGAL::GREEN; - *widget << CGAL::LineWidth(1); - std::list::iterator itp = list_of_polygons.begin(); - while(itp!=list_of_polygons.end()){ - Cgal_Polygon::Edge_const_iterator eci = (*itp).edges_begin(); - while(eci != (*itp).edges_end() ) - { - *widget << (*eci++); - } - itp++; - } - - - if( !list_of_covering.empty() ) - { - *widget << FillColor(CGAL::PURPLE); - std::list::iterator itp = list_of_covering.begin(); - while(itp!=list_of_covering.end()) - { - *widget << (*itp++); - } - } - - *widget << CGAL::YELLOW; - *widget << CGAL::LineWidth(3); - std::list::iterator its = list_of_segments.begin(); - while(its != list_of_segments.end()) - { - *widget << (*its++); - } - - *widget << CGAL::LineWidth(1); - - widget->unlock(); - }; - - - void mousePressEvent(QMouseEvent *e) - { - if(e->button() == Qt::MidButton) - { - if( list_of_polygons.empty() ) - return; - - NT x=static_cast(widget->x_real(e->x())); - NT y=static_cast(widget->y_real(e->y())); - - Point p(x,y); - NT min_dist=100000000; - Polygon_list::iterator it_closest=NULL; - Polygon_list::iterator pit = list_of_polygons.begin(); - - while(pit!=list_of_polygons.end()) - { - Cgal_Polygon::Edge_const_iterator eit = (*pit).edges_begin(); - while(eit != (*pit).edges_end()) - { - NT dist = squared_distance( p, (*eit)); - if( dist < min_dist) - { - min_dist = dist; - it_closest = pit; - } - eit++; - } - pit++; - } - - - Arr::Curve_iterator ci = arr.curve_node_begin(); - while(ci != arr.curve_node_end() ) - { - Cgal_Polygon::Edge_const_iterator eit=(*it_closest).edges_begin(); - while( eit!= (*it_closest).edges_end() ) - { - if( (*ci).curve() == (*eit) ) - { - arr.remove_curve( ci ); - break; - } - eit++; - } - ci++; - } - - list_of_polygons.erase( it_closest ); - list_of_covering.clear(); - list_of_segments.clear(); - - (*widget).redraw(); - } - } - -};//end class - -class MyWindow : public QMainWindow -{ - Q_OBJECT -public: - MyWindow(int w, int h){ - widget = new CGAL::Qt_widget(this); - setCentralWidget(widget); - - //create a timer for checking if somthing changed - QTimer *timer = new QTimer( this ); - connect( timer, SIGNAL(timeout()), - this, SLOT(timer_done()) ); - timer->start( 200, FALSE ); - - // file menu - QPopupMenu * file = new QPopupMenu( this ); - menuBar()->insertItem( "&File", file ); - file->insertItem("&New", this, SLOT(new_instance()), CTRL+Key_N); - file->insertItem("New &Window", this, SLOT(new_window()), CTRL+Key_W); - file->insertSeparator(); - file->insertItem("Print", widget, SLOT(print_to_ps()), CTRL+Key_P); - file->insertSeparator(); - file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_X ); - file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q ); - - // drawing menu - QPopupMenu * algo = new QPopupMenu( this ); - menuBar()->insertItem( "&Algorithms", algo ); - algo->insertItem("&Intersection", this, - SLOT(find_intersection()), CTRL+Key_I ); - algo->insertItem("&Union", this, - SLOT(find_union()), CTRL+Key_U ); - - // help menu - QPopupMenu * help = new QPopupMenu( this ); - menuBar()->insertItem( "&Help", help ); - help->insertItem("How To", this, SLOT(howto()), Key_F1); - help->insertSeparator(); - help->insertItem("&About", this, SLOT(about()), CTRL+Key_A ); - help->insertItem("About &Qt", this, SLOT(aboutQt()) ); - - //the standard toolbar - stoolbar = new CGAL::Qt_widget_standard_toolbar (widget, this, "ST"); - //the new tools toolbar - newtoolbar = new Tools_toolbar(widget, this, &list_of_polygons); - - *widget << CGAL::LineWidth(2) << CGAL::BackgroundColor (CGAL::BLACK); - - resize(w,h); - widget->set_window(-1, 1, -1, 1); - widget->setMouseTracking(TRUE); - - //connect the widget to the main function that receives the objects - connect(widget, SIGNAL(new_cgal_object(CGAL::Object)), - this, SLOT(get_new_object(CGAL::Object))); - - //application flag stuff - old_state = 0; - - //layers - widget->attach(&testlayer); - - }; - -private: - void something_changed(){current_state++;}; - -public slots: - void new_instance() - { - widget->lock(); - list_of_polygons.clear(); - stoolbar->clear_history(); - widget->set_window(-1.1, 1.1, -1.1, 1.1); - // set the Visible Area to the Interval - widget->unlock(); - something_changed(); - } - -private slots: - void get_new_object(CGAL::Object obj) - { - list_of_covering.clear(); - list_of_segments.clear(); - - Cgal_Polygon pol; - if(CGAL::assign(pol,obj)) - { - if(!pol.is_simple()) - { - QMessageBox::about( this, my_title_string, - "Only simple polygons are allowed."); - return; - } - - if(pol.orientation() == CGAL::CLOCKWISE) - pol.reverse_orientation(); - - list_of_polygons.push_back(pol); - - Cgal_Polygon::Edge_const_iterator eci = pol.edges_begin(); - while(eci != pol.edges_end() ) - { - arr.insert( *eci++ ); - } - something_changed(); - } - }; - - void about() - { - QMessageBox::about( this, my_title_string, - "This is a demo for the Arrangement package\n" - "Copyright CGAL @2003"); - }; - - void aboutQt() - { - QMessageBox::aboutQt( this, my_title_string ); - } - - void howto(){ - QString home; - home = "help/index.html"; - HelpWindow *help = new HelpWindow(home, ".", 0, "help viewer"); - help->resize(400, 400); - help->setCaption("Demo HowTo"); - help->show(); - } - - void new_window(){ - MyWindow *ed = new MyWindow(500, 500); - ed->setCaption("Layer"); - ed->stoolbar->clear_history(); - ed->widget->set_window(-1.1, 1.1, -1.1, 1.1); - ed->show(); - something_changed(); - } - - void timer_done() - { - if(old_state!=current_state){ - widget->redraw(); - old_state = current_state; - } - } - - void find_intersection() - { - if( list_of_polygons.empty() ) - { - QMessageBox::about( this, my_title_string, - "Enter some polygons."); - return; - } - - polygons_covering(list_of_polygons, list_of_covering, true); - - something_changed(); - } - - void find_union() - { - if( list_of_polygons.empty() ) - { - QMessageBox::about( this, my_title_string, - "Enter some polygons."); - return; - } - - polygons_covering(list_of_polygons, list_of_covering, false); - - something_changed(); - } - -private: - CGAL::Qt_widget *widget; - CGAL::Qt_widget_standard_toolbar - *stoolbar; - Tools_toolbar *newtoolbar; - int old_state; - Qt_layer_show_ch testlayer; -}; - -#include "demo2.moc" - - -int -main(int argc, char **argv) -{ - QApplication app( argc, argv ); - MyWindow widget(500,500); // physical window size - app.setMainWidget(&widget); - widget.setCaption(my_title_string); - widget.setMouseTracking(TRUE); - widget.show(); - current_state = -1; - return app.exec(); -} - - -//generalized face_diff function, to acount for overlaps. -int face_diff (Arr::Ccb_halfedge_circulator circ) { - Traits t; - int diff = 0; - Arr::Overlap_circulator oc = circ->overlap_edges(); - do { - if (circ->source()->point() == t.curve_source(oc->x_curve()) ) - diff--; //we're inside, going outside - else - diff++; - } while (++oc != circ->overlap_edges()); - - return diff; -} - -// covering_DFS will compute for each face in how many polygons it is. -// It is a recursive DFS function and will be called with the unbounded -// face after its counter has been initialized to 0. -void covering_DFS(Arr::Face_handle f) { - Arr::Ccb_halfedge_circulator start,circ; - - // Do a recursive step for all neighbours, if any exists. - if (f->does_outer_ccb_exist()) { - start = circ = f->outer_ccb(); - do { - if (circ->twin()->face()->counter < 0) { - int diff = face_diff(circ); - circ->twin()->face()->counter = (f->counter + diff); - covering_DFS(circ->twin()->face()); - } - } while (++circ != start); - } - - // Do a recursive step for all holes, if any exists. - Arr::Holes_iterator hit = f->holes_begin(); - for (; Arr::Holes_iterator(hit)!=Arr::Holes_iterator(f->holes_end()); - ++hit) - { - start = circ = (*hit); - do { - if (circ->twin()->face()->counter < 0) { - int diff = face_diff(circ); - circ->twin()->face()->counter = (f->counter + diff); - covering_DFS(circ->twin()->face()); - } - } while (++circ != start); - } -} - -// Convert faces of the arrangement that are in the intersection -// to polygons. -void polygons_from_faces(Arr& arr, - std::list& face_it_list, - std::list& poly_list) -{ - std::list::iterator lit; - Cgal_Polygon poly; - - for (lit = face_it_list.begin(); lit != face_it_list.end(); lit++) { - - poly.erase(poly.vertices_begin(), poly.vertices_end()); - Arr::Ccb_halfedge_circulator cc=(*lit)->outer_ccb(); - do { - poly.push_back(cc->curve().source()); - cc++; - } while (cc != (*lit)->outer_ccb()); - poly_list.push_back(poly); - } -} - -// performs the extraction of data out of the processed arrangement -// if covering = 0, will perform union -// otherwise, if there are n polygons in the arrangement and covering == n -// then will perform intersection -void get_faces_with_covering(std::list& unions, - int covering) -{ - Arr::Face_handle uf = arr.unbounded_face(); - uf->counter = 0; - covering_DFS(uf); - - //"collecting" the union boundary faces. - for(Arr::Face_iterator fit = arr.faces_begin(); fit!=arr.faces_end(); ++fit) - { - if (fit->counter == covering) - { - unions.push_back(fit); - } - } -} - -void get_union() -{ - Arr::Face_handle uf = arr.unbounded_face(); - uf->counter = 0; - covering_DFS(uf); - - Arr::Halfedge_iterator hi = arr.halfedges_begin(); - while(hi != arr.halfedges_end() ) - { - Arr::Face_iterator fit = hi->face(); - if( fit->counter==0 ) - { - list_of_segments.push_back( (*hi).curve() ); - } - hi++; - } - -} - -void clean_count() -{ - for(Arr::Face_iterator fit = arr.faces_begin(); fit!=arr.faces_end(); ++fit) - { - fit->counter = -1; - } -} - -bool polygons_covering(Polygon_list &in_poly_list, - Polygon_list &out_poly_list, bool intersection) -{ - std::list face_it_list; - - clean_count(); - - // faces with a covering two are faces that are in the intersection - // of the two polygons. - if(intersection) - get_faces_with_covering(face_it_list, in_poly_list.size()); - else - { - get_union(); - } - - polygons_from_faces(arr, face_it_list, out_poly_list); - - if (out_poly_list.empty()) return 0; else return 1; -} - -#endif // CGAL_USE_QT diff --git a/Packages/Arrangement/demo/Qt_window/demo3.C b/Packages/Arrangement/demo/Qt_window/demo3.C deleted file mode 100644 index d4b9bb3114b..00000000000 --- a/Packages/Arrangement/demo/Qt_window/demo3.C +++ /dev/null @@ -1,454 +0,0 @@ -// ============================================================================ -// -// Copyright (c) 1997-2003 The CGAL Consortium -// This software and related documentation are part of the Computational -// Geometry Algorithms Library (CGAL). -// This software and documentation are provided "as-is" and without warranty -// of any kind. In no event shall the CGAL Consortium be liable for any -// damage of any kind. -// ---------------------------------------------------------------------- -// -// file : main.C -// package : Qt_widget -// author(s) : Radu Ursu -// coordinator : Laurent Rineau -// -// email : contact@cgal.org -// www : http://www.cgal.org -// -// ====================================================================== - - -// if QT is not installed, a message will be issued in runtime. -#ifndef CGAL_USE_QT -#include -int main(int, char*) -{ - - std::cout << "Sorry, this demo needs QT..."; - std::cout << std::endl; - - return 0; -} - -#else - -#include "cgal_types3.h" - -#include -#include -#include -#include -#include - - -#include -#include -#include "Qt_widget_toolbar3.h" -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -const QString my_title_string("Arrangement Demo with" - " CGAL Qt_widget"); - -//global flags and variables -int current_state; -std::list list_of_segments; -std::list list_of_polygons; - -Arr arr; -bool pl_valid=false; -Point pl_point; - -class Qt_layer_show_ch : public CGAL::Qt_widget_layer -{ -public: - - Qt_layer_show_ch(){}; - - - void draw() - { - widget->lock(); - - *widget << CGAL::GREEN; - *widget << CGAL::LineWidth(1); - std::list::iterator itp = list_of_polygons.begin(); - while(itp!=list_of_polygons.end()){ - Cgal_Polygon::Edge_const_iterator eci = (*itp).edges_begin(); - Cgal_Polygon::Edge_const_iterator last_edge=(*itp).edges_end(); - last_edge--; - while(eci != last_edge ) - { - *widget << (*eci++); - } - itp++; - } - - - if(pl_valid && !(arr.halfedges_begin() == arr.halfedges_end()) ) - { - *widget << CGAL::LineWidth(3); - *widget << CGAL::YELLOW; - - Arr::Locate_type lt; - Arr::Point temp_p(pl_point.x(),pl_point.y()); - Arr::Halfedge_handle e = arr.locate(temp_p, lt); -// std::cout << "locate type " << lt << std::endl; - - //color the face on the screen - Arr::Face_handle f=e->face(); - - - if (f->does_outer_ccb_exist()) - { - Arr::Ccb_halfedge_circulator cc=f->outer_ccb(); - do { - CGAL::Polyline_2::const_iterator points_iter; - for (points_iter = cc->curve().begin(); points_iter != cc->curve().end(); ) - { - CGAL::Polyline_2::const_iterator source_point = points_iter; - points_iter++; - CGAL::Polyline_2::const_iterator target_point = points_iter; - - if (target_point == cc->curve().end()) - break; - - Segment s(*source_point, *target_point); - *widget << s; - } - } while (++cc != f->outer_ccb()); - - } - - Arr::Holes_iterator hit=f->holes_begin(),eit=f->holes_end(); - for (;hit!=eit; ++hit) - { - Arr::Ccb_halfedge_circulator cc=*hit; - do - { - CGAL::Polyline_2::const_iterator points_iter; - for (points_iter = cc->curve().begin(); points_iter != cc->curve().end(); ) - { - CGAL::Polyline_2::const_iterator source_point = points_iter; - points_iter++; - CGAL::Polyline_2::const_iterator target_point = points_iter; - - if (target_point == cc->curve().end()) - break; - - Segment s(*source_point, *target_point); - *widget << s; - } - } while (++cc != *hit); - } - *widget << CGAL::LineWidth(1); - } - - widget->unlock(); - }; - - void mousePressEvent(QMouseEvent *e) - { - if(e->button() == Qt::MidButton) - { - pl_valid = false; - - if( list_of_polygons.empty() ) - return; - - NT x=static_cast(widget->x_real(e->x())); - NT y=static_cast(widget->y_real(e->y())); - - Point p(x,y); - NT min_dist=100000000; - std::list::iterator it_closest=NULL; - std::list::iterator pit = list_of_polygons.begin(); - - Segment closest_segment; - - while(pit!=list_of_polygons.end()) - { - Cgal_Polygon::Edge_const_iterator eit = (*pit).edges_begin(); - Cgal_Polygon::Edge_const_iterator last_edge=(*pit).edges_end(); - last_edge--; - while(eit != last_edge ) - { - NT dist = squared_distance( p, (*eit)); - if( dist < min_dist) - { - min_dist = dist; - it_closest = pit; - closest_segment = (*eit); - } - eit++; - } - pit++; - } - - - - Arr::Curve_iterator ci = arr.curve_node_begin(); - while(ci != arr.curve_node_end() ) - { - bool found=false; - - CGAL::Polyline_2::const_iterator points_iter; - for (points_iter = ci->curve().begin(); points_iter != ci->curve().end(); ) - { - CGAL::Polyline_2::const_iterator source_point = points_iter; - points_iter++; - CGAL::Polyline_2::const_iterator target_point = points_iter; - - if (target_point == ci->curve().end()) - break; - - Segment s(*source_point, *target_point); - if(s == closest_segment) - { - arr.remove_curve(ci); - found=true; - break; - } - } - if(found) - break; - - ci++; - } - - list_of_polygons.erase( it_closest ); -// list_of_covering.clear(); -// list_of_segments.clear(); - - (*widget).redraw(); - } - }; - -};//end class - -class MyWindow : public QMainWindow -{ - Q_OBJECT -public: - MyWindow(int w, int h){ - widget = new CGAL::Qt_widget(this); - setCentralWidget(widget); - - //create a timer for checking if somthing changed - QTimer *timer = new QTimer( this ); - connect( timer, SIGNAL(timeout()), - this, SLOT(timer_done()) ); - timer->start( 200, FALSE ); - - // file menu - QPopupMenu * file = new QPopupMenu( this ); - menuBar()->insertItem( "&File", file ); - file->insertItem("&New", this, SLOT(new_instance()), CTRL+Key_N); - file->insertItem("New &Window", this, SLOT(new_window()), CTRL+Key_W); - file->insertSeparator(); - file->insertItem("Print", widget, SLOT(print_to_ps()), CTRL+Key_P); - file->insertSeparator(); - file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_X ); - file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q ); - - // drawing menu - QPopupMenu * draw = new QPopupMenu( this ); - menuBar()->insertItem( "&Draw", draw ); - draw->insertItem("&Generate polylines", this, - SLOT(gen_segments()), CTRL+Key_G ); - - // help menu - QPopupMenu * help = new QPopupMenu( this ); - menuBar()->insertItem( "&Help", help ); - help->insertItem("How To", this, SLOT(howto()), Key_F1); - help->insertSeparator(); - help->insertItem("&About", this, SLOT(about()), CTRL+Key_A ); - help->insertItem("About &Qt", this, SLOT(aboutQt()) ); - - //the standard toolbar - stoolbar = new CGAL::Qt_widget_standard_toolbar (widget, this, "ST"); - //the new tools toolbar - newtoolbar = new Tools_toolbar(widget, this, &list_of_segments); - - *widget << CGAL::LineWidth(2) << CGAL::BackgroundColor (CGAL::BLACK); - - resize(w,h); - widget->set_window(-1, 1, -1, 1); - widget->setMouseTracking(TRUE); - - //connect the widget to the main function that receives the objects - connect(widget, SIGNAL(new_cgal_object(CGAL::Object)), - this, SLOT(get_new_object(CGAL::Object))); - - //application flag stuff - old_state = 0; - - //layers - widget->attach(&testlayer); - - }; - -private: - void something_changed(){current_state++;}; - -public slots: - void new_instance() - { - widget->lock(); - list_of_segments.clear(); - stoolbar->clear_history(); - widget->set_window(-1.1, 1.1, -1.1, 1.1); - // set the Visible Area to the Interval - widget->unlock(); - something_changed(); - } - -private slots: - void get_new_object(CGAL::Object obj) - { - pl_valid = false; - - - Cgal_Polygon pol; - if(CGAL::assign(pol,obj)) - { - list_of_polygons.push_back(pol); - - std::vector pts; - - Cgal_Polygon::Edge_const_iterator eci = pol.edges_begin(); - while(eci != pol.edges_end() ) - { - Curve c= *eci++; - Seg_traits ST; - pts.push_back( ST.curve_source(c) ); - } - - Traits::Curve_2 pol( pts.begin(), pts.end() ); - arr.insert( pol ); - something_changed(); - } - - Point p; - if(CGAL::assign(p,obj)) { - - pl_point = p; - pl_valid = true; - - something_changed(); - } - - }; - - void about() - { - QMessageBox::about( this, my_title_string, - "This is a demo for the Arrangement package\n" - "Copyright CGAL @2003"); - }; - - void aboutQt() - { - QMessageBox::aboutQt( this, my_title_string ); - } - - void howto(){ - QString home; - home = "help/index.html"; - HelpWindow *help = new HelpWindow(home, ".", 0, "help viewer"); - help->resize(400, 400); - help->setCaption("Demo HowTo"); - help->show(); - } - - void new_window(){ - MyWindow *ed = new MyWindow(500, 500); - ed->setCaption("Layer"); - ed->stoolbar->clear_history(); - ed->widget->set_window(-1.1, 1.1, -1.1, 1.1); - ed->show(); - something_changed(); - } - - void timer_done() - { - if(old_state!=current_state){ - widget->redraw(); - old_state = current_state; - } - } - - void gen_segments() - { - stoolbar->clear_history(); - widget->set_window(-1.1, 1.1, -1.1, 1.1); - - // send resizeEvent only on show. - std::list list_of_points; - CGAL::Random_points_in_square_2 g(1); - for(int count=0; count<5; count++) - { - list_of_points.clear(); - for(int i=0; i<5; i++) - { - list_of_points.push_back(*g++); - } - CGAL::Polyline_2 p(list_of_points.begin(), list_of_points.end() ); - - Cgal_Polygon pol(list_of_points.begin(), list_of_points.end() ); - - list_of_polygons.push_back(pol); - - arr.insert(p); - } - - pl_valid = false; - - something_changed(); - - } - - -private: - CGAL::Qt_widget *widget; - CGAL::Qt_widget_standard_toolbar - *stoolbar; - Tools_toolbar *newtoolbar; - int old_state; - Qt_layer_show_ch testlayer; -}; - -#include "demo3.moc" - - -int -main(int argc, char **argv) -{ - QApplication app( argc, argv ); - MyWindow widget(500,500); // physical window size - app.setMainWidget(&widget); - widget.setCaption(my_title_string); - widget.setMouseTracking(TRUE); - widget.show(); - current_state = -1; - return app.exec(); -} - -#endif // CGAL_USE_QT diff --git a/Packages/Arrangement/demo/Qt_window/makefile b/Packages/Arrangement/demo/Qt_window/makefile deleted file mode 100644 index 13b004ac8f9..00000000000 --- a/Packages/Arrangement/demo/Qt_window/makefile +++ /dev/null @@ -1,107 +0,0 @@ -# Created by the script create_makefile -# This is the makefile for compiling a CGAL application. - -#---------------------------------------------------------------------# -# include platform specific settings -#---------------------------------------------------------------------# -# Choose the right include file from the /make directory. - -# CGAL_MAKEFILE = ENTER_YOUR_INCLUDE_MAKEFILE_HERE -include $(CGAL_MAKEFILE) - -#---------------------------------------------------------------------# -# compiler flags -#---------------------------------------------------------------------# - -CXXFLAGS = -I../../../include/ \ - $(CGAL_CXXFLAGS) \ - $(LONG_NAME_PROBLEM_CXXFLAGS) \ - $(DEBUG_OPT) - -#---------------------------------------------------------------------# -# linker flags -#---------------------------------------------------------------------# - -LIBPATH = \ - $(CGAL_LIBPATH) - -LDFLAGS = \ - $(LONG_NAME_PROBLEM_LDFLAGS) \ - $(CGAL_QT_LDFLAGS) \ - -#---------------------------------------------------------------------# -# target entries -#---------------------------------------------------------------------# - -all: demo1 demo2 demo3 - -Qt_widget_toolbar1$(OBJ_EXT): Qt_widget_toolbar1.C Qt_widget_toolbar1.moc - $(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) Qt_widget_toolbar1.C - -Qt_widget_toolbar1.moc: Qt_widget_toolbar1.h - $(QT_MOC) -o Qt_widget_toolbar1.moc Qt_widget_toolbar1.h - -demo1$(OBJ_EXT): demo1.C demo1.moc - $(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) demo1.C - -demo1.moc: demo1.C - ${QT_MOC} -o demo1.moc demo1.C - -demo1$(EXE_EXT): demo1$(OBJ_EXT) \ - Qt_widget_toolbar1$(OBJ_EXT) - $(CGAL_CXX) $(EXE_OPT)demo1 \ - demo1$(OBJ_EXT) \ - Qt_widget_toolbar1$(OBJ_EXT) \ - $(LDFLAGS) - -Qt_widget_toolbar2$(OBJ_EXT): Qt_widget_toolbar2.C Qt_widget_toolbar2.moc - $(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) Qt_widget_toolbar2.C - -Qt_widget_toolbar2.moc: Qt_widget_toolbar2.h - $(QT_MOC) -o Qt_widget_toolbar2.moc Qt_widget_toolbar2.h - -demo2$(OBJ_EXT): demo2.C demo2.moc - $(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) demo2.C - -demo2.moc: demo2.C - ${QT_MOC} -o demo2.moc demo2.C - -demo2$(EXE_EXT): demo2$(OBJ_EXT) \ - Qt_widget_toolbar2$(OBJ_EXT) - $(CGAL_CXX) $(EXE_OPT)demo2 \ - demo2$(OBJ_EXT) \ - Qt_widget_toolbar2$(OBJ_EXT) \ - $(LDFLAGS) - -Qt_widget_toolbar3$(OBJ_EXT): Qt_widget_toolbar3.C Qt_widget_toolbar3.moc - $(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) Qt_widget_toolbar3.C - -Qt_widget_toolbar3.moc: Qt_widget_toolbar3.h - $(QT_MOC) -o Qt_widget_toolbar3.moc Qt_widget_toolbar3.h - -demo3$(OBJ_EXT): demo3.C demo3.moc - $(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) demo3.C - -demo3.moc: demo3.C - ${QT_MOC} -o demo3.moc demo3.C - -demo3$(EXE_EXT): demo3$(OBJ_EXT) \ - Qt_widget_toolbar3$(OBJ_EXT) - $(CGAL_CXX) $(EXE_OPT)demo3 \ - demo3$(OBJ_EXT) \ - Qt_widget_toolbar3$(OBJ_EXT) \ - $(LDFLAGS) - -clean: demo1.clean \ - Qt_widget_toolbar1.clean \ - demo2.clean \ - Qt_widget_toolbar2.clean \ - demo3.clean \ - Qt_widget_toolbar3.clean \ - -#---------------------------------------------------------------------# -# suffix rules -#---------------------------------------------------------------------# - -.C$(OBJ_EXT): - $(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) $< diff --git a/Packages/Arrangement/demo/Qt_window/polyline.xpm b/Packages/Arrangement/demo/Qt_window/polyline.xpm deleted file mode 100644 index 30b014bbc86..00000000000 --- a/Packages/Arrangement/demo/Qt_window/polyline.xpm +++ /dev/null @@ -1,66 +0,0 @@ -/* XPM */ - char *polyline_xpm[] = { -/* columns rows colors chars-per-pixel */ -"32 32 4 1", -" c opaque", -". c navy", -"X c #c0c0c0", -"o c None", -/* pixels */ -"oooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooo", -"oooooo XXXXXXXXXXXXXXXXXXXXXXooo", -"oooooo XXXXXXXXXXXXXXXXXXXXXXooo", -"oooooo XXXXXXXXXXXXXXXXXXXXXXooo", -"oooooo XXXXXXXXXXXXXXXXXXXXXXooo", -"oooooo XXXXXXXXXXXX oo", -"oooooo XXXXXXXXXXXX oooooooooooo", -"oooooo XXXXXXXXXXXX oooooooooooo", -"oooooo XXXX oooooooooooo", -"oooooooooooooo XXXX oooooooooooo", -"oooooooooooooo XXXX oooo", -"oooooooooooooo XXXXXXXXXXXX oooo", -"oooooooooooooo XXXXXXXXXXXX oooo", -"oooooooooooooo XXXXXXXXXXXX oooo", -"oooooooooooooo XXXXXXXXXXXX oooo", -"oooooooooooooo XXXXXXX oooo", -"ooooooooooooooooooo XXXXXXX oooo", -"ooooooooooooooooooo XXXXXXX oooo", -"ooooo........oooooo XXXXXXX oooo", -"ooooooo......oooooo XXXXXXX oooo", -"ooooooo......oooooo oooo", -"oooooo.......ooooooooooooooooooo", -"ooooo........ooooooooooooooooooo", -"oooo.........ooooooooooooooooooo", -"ooo.......oo.ooooooooooooooooooo", -"ooo......ooo.ooooooooooooooooooo", -"ooo.....oooooooooooooooooooooooo", -"ooo....ooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooo", -"oooooooooooooooooooooooooooooooo" -}; - -/* XPM */ - char * polyline_small_xpm[] = { -"16 16 4 1", -" c None", -". c #EDA1A1", -"+ c #000000", -"@ c #1F0670", -" ........ ", -" .......... ", -" ...+........ ", -" ....+......... ", -".....++++.......", -"........+.......", -"........+.......", -"........+++.....", -"..........+.....", -"..@@@@@...+.....", -"...@@@@...+..+..", -"...@@@@...++++..", -" .@@@@@........ ", -" @@@..@....... ", -"@@@.......... ", -"@@ ........ "};