mirror of https://github.com/CGAL/cgal
In src/CGALQt4:
- add the class CGAL::Qt::DemosMainWindow in libCGALQt4, - compile moc generated files separately In demo/ - new sub-directory demo/resources/ that contains, for now, about_CGAL.html - move the two triangulation demos from demo/GraphicsView to demo/Triangulation_2 (to prepare the inclusion in CGAL internal release). - For each demo, merge all .h and .cpp files. Each demo now has a ui file, a cpp file and a qrc file (and a html file for the "About demo..." menu entry). - rename the demos to Delaunay_triangulation_2(.exe) and Constrained_Delaunay_triangulation_2(.exe)
This commit is contained in:
parent
bc0ff05088
commit
5ddfd30c93
|
|
@ -1899,16 +1899,15 @@ Generator/doc_tex/Generator/generators_prog2.ps -text svneol=unset#application/p
|
|||
Generator/doc_tex/Generator/generators_prog2_small.gif -text svneol=unset#image/gif
|
||||
GraphicsView/GraphicsView.odp -text
|
||||
GraphicsView/TODO -text
|
||||
GraphicsView/demo/GraphicsView/Constrained_Delaunay_triangulation_MainWindow.qrc -text
|
||||
GraphicsView/demo/GraphicsView/Constrained_Delaunay_triangulation_MainWindow.ui -text
|
||||
GraphicsView/demo/GraphicsView/Delaunay_triangulation_MainWindow.qrc -text
|
||||
GraphicsView/demo/GraphicsView/Delaunay_triangulation_MainWindow.ui -text
|
||||
GraphicsView/demo/GraphicsView/about_CGAL.html svneol=native#text/html
|
||||
GraphicsView/demo/GraphicsView/about_Delaunay_triangulation.html svneol=native#text/html
|
||||
GraphicsView/demo/GraphicsView/about_constrained_Delaunay_triangulation.html svneol=native#text/html
|
||||
GraphicsView/demo/GraphicsView/icons/circumcenter.pdf -text
|
||||
GraphicsView/demo/GraphicsView/icons/circumcenter.png -text
|
||||
GraphicsView/demo/GraphicsView/icons/movingPoint.png -text
|
||||
GraphicsView/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.qrc -text
|
||||
GraphicsView/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.ui -text
|
||||
GraphicsView/demo/Triangulation_2/Delaunay_triangulation_2.qrc -text
|
||||
GraphicsView/demo/Triangulation_2/Delaunay_triangulation_2.ui -text
|
||||
GraphicsView/demo/Triangulation_2/about_Constrained_Delaunay_triangulation_2.html svneol=native#text/html
|
||||
GraphicsView/demo/Triangulation_2/about_Delaunay_triangulation_2.html svneol=native#text/html
|
||||
GraphicsView/demo/Triangulation_2/icons/circumcenter.pdf -text
|
||||
GraphicsView/demo/Triangulation_2/icons/circumcenter.png -text
|
||||
GraphicsView/demo/Triangulation_2/icons/movingPoint.png -text
|
||||
GraphicsView/demo/icons/Delaunay_triangulation_2.png -text
|
||||
GraphicsView/demo/icons/File.qrc -text
|
||||
GraphicsView/demo/icons/Input.qrc -text
|
||||
|
|
@ -1923,6 +1922,7 @@ GraphicsView/demo/icons/fileSave.png -text
|
|||
GraphicsView/demo/icons/inputPoint.png -text svneol=unset#image/png
|
||||
GraphicsView/demo/icons/inputPolyline.png -text
|
||||
GraphicsView/demo/icons/zoom-best-fit.svg -text
|
||||
GraphicsView/demo/resources/about_CGAL.html svneol=native#text/html
|
||||
GraphicsView/doc_tex/GraphicsView/uml-design.eps -text
|
||||
GraphicsView/doc_tex/GraphicsView/uml-design.graphml -text
|
||||
GraphicsView/doc_tex/GraphicsView/uml-design.pdf -text
|
||||
|
|
|
|||
|
|
@ -16,6 +16,12 @@ GraphicsView/demo/GraphicsView/constrained_Delaunay_triangulation
|
|||
GraphicsView/demo/GraphicsView/min
|
||||
GraphicsView/demo/GraphicsView/qrc_*.cxx
|
||||
GraphicsView/demo/GraphicsView/ui_*.h
|
||||
GraphicsView/demo/Triangulation_2/*.exe
|
||||
GraphicsView/demo/Triangulation_2/Constrained_delaunay_triangulation_2
|
||||
GraphicsView/demo/Triangulation_2/Delaunay_triangulation_2
|
||||
GraphicsView/demo/Triangulation_2/Makefile
|
||||
GraphicsView/demo/Triangulation_2/qrc_*.cxx
|
||||
GraphicsView/demo/Triangulation_2/ui_*.h
|
||||
GraphicsView/doc_tex/GraphicsView.tex
|
||||
GraphicsView/doc_tex/GraphicsView/auto
|
||||
GraphicsView/doc_tex/GraphicsView_ref/auto
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
project (GraphicsView)
|
||||
|
|
@ -20,54 +19,6 @@ include(${QT_USE_FILE})
|
|||
include_directories (BEFORE ../../include)
|
||||
link_directories(../../src/CGALQt4)
|
||||
|
||||
#--------------------------------
|
||||
# The "constrained Delaunay" demo: constrained_Delaunay_triangulation
|
||||
#--------------------------------
|
||||
# UI files (Qt Designer files)
|
||||
qt4_wrap_ui( UI_FILES_CDT Constrained_Delaunay_triangulation_MainWindow.ui )
|
||||
|
||||
# qrc files (resources files, that contain icons, at least)
|
||||
qt4_add_resources ( RESOURCE_FILES_CDT ./Constrained_Delaunay_triangulation_MainWindow.qrc ../icons/Input.qrc ../icons/File.qrc ../icons/Triangulation_2.qrc )
|
||||
|
||||
# use the Qt MOC preprocessor on classes that derives from QObject
|
||||
qt4_automoc( Constrained_Delaunay_triangulation_MainWindow.cpp )
|
||||
qt4_automoc( DemosMainWindow.cpp )
|
||||
|
||||
# The executable itself.
|
||||
add_executable ( constrained_Delaunay_triangulation constrained_Delaunay_triangulation.cpp Constrained_Delaunay_triangulation_MainWindow.cpp DemosMainWindow.cpp ${UI_FILES_CDT} ${RESOURCE_FILES_CDT} )
|
||||
|
||||
# Link with Qt libraries
|
||||
target_link_libraries( constrained_Delaunay_triangulation ${QT_LIBRARIES} )
|
||||
if ( NOT AUTO_LINK_ENABLED )
|
||||
# If auto-link is not enabled (on Linux for example), link with libCGAL explicitly.
|
||||
target_link_libraries( constrained_Delaunay_triangulation CGAL )
|
||||
endif()
|
||||
target_link_libraries( constrained_Delaunay_triangulation CGAL-Qt4 )
|
||||
|
||||
#--------------------------------
|
||||
# The "Delaunay" demo: Delaunay_triangulation
|
||||
#--------------------------------
|
||||
# UI files (Qt Designer files)
|
||||
qt4_wrap_ui( UI_FILES_DT Delaunay_triangulation_MainWindow.ui )
|
||||
|
||||
# qrc files (resources files, that contain icons, at least)
|
||||
qt4_add_resources ( RESOURCE_FILES_DT ./Delaunay_triangulation_MainWindow.qrc ../icons/Input.qrc ../icons/File.qrc ../icons/Triangulation_2.qrc )
|
||||
|
||||
# use the Qt MOC preprocessor on classes that derives from QObject
|
||||
qt4_automoc( Delaunay_triangulation_MainWindow.cpp )
|
||||
|
||||
# The executable itself.
|
||||
add_executable ( Delaunay_triangulation Delaunay_triangulation.cpp Delaunay_triangulation_MainWindow.cpp DemosMainWindow.cpp ${UI_FILES_DT} ${RESOURCE_FILES_DT} )
|
||||
|
||||
# Link with Qt libraries
|
||||
target_link_libraries( Delaunay_triangulation ${QT_LIBRARIES} )
|
||||
if ( NOT AUTO_LINK_ENABLED )
|
||||
# If auto-link is not enabled (on Linux for example), link with libCGAL explicitly.
|
||||
target_link_libraries( Delaunay_triangulation CGAL )
|
||||
endif()
|
||||
target_link_libraries( Delaunay_triangulation CGAL-Qt4 )
|
||||
|
||||
|
||||
#----------------------------------------
|
||||
# minimal graphics view executable: min
|
||||
#----------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,106 +0,0 @@
|
|||
#ifndef CONSTRAINED_DELAUNAY_TRIANGULATION_MAIN_WINDOW_H
|
||||
#define CONSTRAINED_DELAUNAY_TRIANGULATION_MAIN_WINDOW_H
|
||||
|
||||
#include <QtGui>
|
||||
#include <QString>
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
|
||||
|
||||
#include "ui_Constrained_Delaunay_triangulation_MainWindow.h"
|
||||
#include "DemosMainWindow.h"
|
||||
|
||||
// forward declarations
|
||||
namespace CGAL {
|
||||
namespace Qt {
|
||||
template <class Delaunay> class ConstrainedTriangulationGraphicsItem;
|
||||
template <class Delaunay> class TriangulationMovingPoint;
|
||||
template <class Delaunay> class TriangulationCircumcircle;
|
||||
template <class K> class GraphicsViewPolylineInput;
|
||||
} // namespace Qt
|
||||
} // namespace CGAL
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef K::Point_2 Point_2;
|
||||
typedef CGAL::Triangulation_vertex_base_2<K> Vertex_base;
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<K> Face_base;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vertex_base, Face_base> TDS;
|
||||
typedef CGAL::Exact_predicates_tag Itag;
|
||||
|
||||
|
||||
typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, Itag> Delaunay;
|
||||
|
||||
class Constrained_Delaunay_triangulation_MainWindow :
|
||||
public CGAL::Qt::DemosMainWindow,
|
||||
public Ui::Constrained_Delaunay_triangulation_MainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
Delaunay dt;
|
||||
QGraphicsScene scene;
|
||||
|
||||
CGAL::Qt::ConstrainedTriangulationGraphicsItem<Delaunay> * dgi;
|
||||
|
||||
CGAL::Qt::TriangulationMovingPoint<Delaunay> * mp;
|
||||
CGAL::Qt::GraphicsViewPolylineInput<K> * pi;
|
||||
CGAL::Qt::TriangulationCircumcircle<Delaunay> *tcc;
|
||||
public:
|
||||
Constrained_Delaunay_triangulation_MainWindow();
|
||||
|
||||
private:
|
||||
template <typename Iterator>
|
||||
void insert_polyline(Iterator b, Iterator e)
|
||||
{
|
||||
Point_2 p, q;
|
||||
Delaunay::Vertex_handle vh, wh;
|
||||
Iterator it = b;
|
||||
vh = dt.insert(*it);
|
||||
p = *it;
|
||||
++it;
|
||||
for(; it != e; ++it){
|
||||
q = *it;
|
||||
if(p != q){
|
||||
wh = dt.insert(*it);
|
||||
dt.insert_constraint(vh,wh);
|
||||
vh = wh;
|
||||
p = q;
|
||||
} else {
|
||||
std::cout << "duplicate point: " << p << std::endl;
|
||||
}
|
||||
}
|
||||
emit(changed());
|
||||
}
|
||||
|
||||
public slots:
|
||||
|
||||
void processInput(CGAL::Object o);
|
||||
|
||||
void on_actionMovingPoint_toggled(bool checked);
|
||||
|
||||
void on_actionShowDelaunay_toggled(bool checked);
|
||||
|
||||
void on_actionInsertPolyline_toggled(bool checked);
|
||||
|
||||
void on_actionCircumcenter_toggled(bool checked);
|
||||
|
||||
void on_actionClear_triggered();
|
||||
|
||||
void on_actionRecenter_triggered();
|
||||
|
||||
void on_actionLoadConstraints_triggered();
|
||||
|
||||
void loadConstraints(QString);
|
||||
|
||||
void on_actionSaveConstraints_triggered();
|
||||
|
||||
void saveConstraints(QString);
|
||||
|
||||
void on_actionInsertRandomPoints_triggered();
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
};
|
||||
|
||||
#endif // CONSTRAINED_DELAUNAY_TRIANGULATION_MAIN_WINDOW_H
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
|
||||
|
||||
#include <QApplication>
|
||||
#include "Delaunay_triangulation_MainWindow.h"
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
Delaunay_triangulation_MainWindow mainWindow;
|
||||
mainWindow.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
#ifndef DELAUNAY_TRIANGULATION_MAIN_WINDOW_H
|
||||
#define DELAUNAY_TRIANGULATION_MAIN_WINDOW_H
|
||||
|
||||
#include <QtGui>
|
||||
#include <QString>
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Delaunay_triangulation_2.h>
|
||||
|
||||
#include "ui_Delaunay_triangulation_MainWindow.h"
|
||||
#include "DemosMainWindow.h"
|
||||
|
||||
// forward declarations
|
||||
namespace CGAL {
|
||||
namespace Qt {
|
||||
template <class Delaunay> class TriangulationGraphicsItem;
|
||||
template <class Delaunay> class VoronoiGraphicsItem;
|
||||
template <class Delaunay> class TriangulationMovingPoint;
|
||||
template <class Delaunay> class TriangulationCircumcircle;
|
||||
template <class K> class GraphicsViewPolylineInput;
|
||||
} // namespace Qt
|
||||
} // namespace CGAL
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef K::Point_2 Point_2;
|
||||
|
||||
typedef CGAL::Delaunay_triangulation_2<K> Delaunay;
|
||||
|
||||
class Delaunay_triangulation_MainWindow :
|
||||
public CGAL::Qt::DemosMainWindow,
|
||||
public Ui::Delaunay_triangulation_MainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
Delaunay dt;
|
||||
QGraphicsScene scene;
|
||||
|
||||
CGAL::Qt::TriangulationGraphicsItem<Delaunay> * dgi;
|
||||
CGAL::Qt::VoronoiGraphicsItem<Delaunay> * vgi;
|
||||
|
||||
CGAL::Qt::TriangulationMovingPoint<Delaunay> * mp;
|
||||
CGAL::Qt::GraphicsViewPolylineInput<K> * pi;
|
||||
CGAL::Qt::TriangulationCircumcircle<Delaunay> *tcc;
|
||||
public:
|
||||
Delaunay_triangulation_MainWindow();
|
||||
|
||||
public slots:
|
||||
|
||||
void processInput(CGAL::Object o);
|
||||
|
||||
void on_actionMovingPoint_toggled(bool checked);
|
||||
|
||||
void on_actionShowDelaunay_toggled(bool checked);
|
||||
|
||||
void on_actionShowVoronoi_toggled(bool checked);
|
||||
|
||||
void on_actionInsertPoint_toggled(bool checked);
|
||||
|
||||
void on_actionCircumcenter_toggled(bool checked);
|
||||
|
||||
void on_actionClear_triggered();
|
||||
|
||||
void on_actionRecenter_triggered();
|
||||
|
||||
void on_actionLoadConstraints_triggered();
|
||||
|
||||
void loadConstraints(QString);
|
||||
|
||||
void on_actionSaveConstraints_triggered();
|
||||
|
||||
void saveConstraints(QString);
|
||||
|
||||
void on_actionInsertRandomPoints_triggered();
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
};
|
||||
|
||||
#endif // DELAUNAY_TRIANGULATION_MAIN_WINDOW_H
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
|
||||
|
||||
#include <QApplication>
|
||||
#include "Constrained_Delaunay_triangulation_MainWindow.h"
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
Constrained_Delaunay_triangulation_MainWindow mainWindow;
|
||||
mainWindow.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
project (GraphicsView)
|
||||
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
include(${CGAL_USE_FILE})
|
||||
|
||||
set( QT_USE_QTXML TRUE )
|
||||
set( QT_USE_QTMAIN TRUE )
|
||||
set( QT_USE_QTSCRIPT TRUE )
|
||||
set( QT_USE_QTOPENGL TRUE )
|
||||
|
||||
|
||||
find_package(Qt4 REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
include_directories (BEFORE ../../include)
|
||||
link_directories(../../src/CGALQt4)
|
||||
|
||||
#--------------------------------
|
||||
# The "constrained Delaunay" demo: Constrained_delaunay_triangulation_2
|
||||
#--------------------------------
|
||||
# UI files (Qt Designer files)
|
||||
qt4_wrap_ui( CDT_UI_FILES Constrained_Delaunay_triangulation_2.ui )
|
||||
|
||||
# qrc files (resources files, that contain icons, at least)
|
||||
qt4_add_resources ( CDT_RESOURCE_FILES ./Constrained_Delaunay_triangulation_2.qrc )
|
||||
|
||||
# use the Qt MOC preprocessor on classes that derives from QObject
|
||||
qt4_generate_moc( Constrained_Delaunay_triangulation_2.cpp Constrained_Delaunay_triangulation_2.moc )
|
||||
|
||||
# The executable itself.
|
||||
add_executable ( Constrained_delaunay_triangulation_2 Constrained_Delaunay_triangulation_2.cpp ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} )
|
||||
|
||||
# Link with Qt libraries
|
||||
target_link_libraries( Constrained_delaunay_triangulation_2 ${QT_LIBRARIES} )
|
||||
if ( NOT AUTO_LINK_ENABLED )
|
||||
# If auto-link is not enabled (on Linux for example), link with libCGAL explicitly.
|
||||
target_link_libraries( Constrained_delaunay_triangulation_2 CGAL )
|
||||
endif()
|
||||
target_link_libraries( Constrained_delaunay_triangulation_2 CGAL-Qt4 )
|
||||
|
||||
#--------------------------------
|
||||
# The "Delaunay" demo: Delaunay_triangulation_2
|
||||
#--------------------------------
|
||||
# UI files (Qt Designer files)
|
||||
qt4_wrap_ui( DT_UI_FILES Delaunay_triangulation_2.ui )
|
||||
|
||||
# qrc files (resources files, that contain icons, at least)
|
||||
qt4_add_resources ( DT_RESOURCE_FILES ./Delaunay_triangulation_2.qrc )
|
||||
|
||||
# use the Qt MOC preprocessor on classes that derives from QObject
|
||||
qt4_generate_moc( Delaunay_triangulation_2.cpp Delaunay_triangulation_2.moc )
|
||||
|
||||
# The executable itself.
|
||||
add_executable ( Delaunay_triangulation_2 Delaunay_triangulation_2.cpp ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
|
||||
|
||||
# Link with Qt libraries
|
||||
target_link_libraries( Delaunay_triangulation_2 ${QT_LIBRARIES} )
|
||||
if ( NOT AUTO_LINK_ENABLED )
|
||||
# If auto-link is not enabled (on Linux for example), link with libCGAL explicitly.
|
||||
target_link_libraries( Delaunay_triangulation_2 CGAL )
|
||||
endif()
|
||||
target_link_libraries( Delaunay_triangulation_2 CGAL-Qt4 )
|
||||
|
|
@ -1,17 +1,122 @@
|
|||
#include <fstream>
|
||||
#include "Constrained_Delaunay_triangulation_MainWindow.h"
|
||||
|
||||
// CGAL headers
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
|
||||
|
||||
#include <CGAL/point_generators_2.h>
|
||||
|
||||
// Qt headers
|
||||
#include <QtGui>
|
||||
#include <QString>
|
||||
#include <QActionGroup>
|
||||
#include <QFileDialog>
|
||||
#include <QInputDialog>
|
||||
#include <CGAL/point_generators_2.h>
|
||||
|
||||
// GraphicsView items and event filters (input classes)
|
||||
#include "TriangulationCircumcircle.h"
|
||||
#include "TriangulationMovingPoint.h"
|
||||
#include <CGAL/Qt/GraphicsViewPolylineInput.h>
|
||||
#include <CGAL/Qt/ConstrainedTriangulationGraphicsItem.h>
|
||||
|
||||
Constrained_Delaunay_triangulation_MainWindow::Constrained_Delaunay_triangulation_MainWindow()
|
||||
// the two base classes
|
||||
#include "ui_Constrained_Delaunay_triangulation_2.h"
|
||||
#include <CGAL/Qt/DemosMainWindow.h>
|
||||
|
||||
// forward declarations
|
||||
namespace CGAL {
|
||||
namespace Qt {
|
||||
template <class Delaunay> class ConstrainedTriangulationGraphicsItem;
|
||||
template <class Delaunay> class TriangulationMovingPoint;
|
||||
template <class Delaunay> class TriangulationCircumcircle;
|
||||
template <class K> class GraphicsViewPolylineInput;
|
||||
} // namespace Qt
|
||||
} // namespace CGAL
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef K::Point_2 Point_2;
|
||||
typedef CGAL::Triangulation_vertex_base_2<K> Vertex_base;
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<K> Face_base;
|
||||
typedef CGAL::Triangulation_data_structure_2<Vertex_base, Face_base> TDS;
|
||||
typedef CGAL::Exact_predicates_tag Itag;
|
||||
|
||||
|
||||
typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, Itag> Delaunay;
|
||||
|
||||
class MainWindow :
|
||||
public CGAL::Qt::DemosMainWindow,
|
||||
public Ui::Constrained_Delaunay_triangulation_2
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
Delaunay dt;
|
||||
QGraphicsScene scene;
|
||||
|
||||
CGAL::Qt::ConstrainedTriangulationGraphicsItem<Delaunay> * dgi;
|
||||
|
||||
CGAL::Qt::TriangulationMovingPoint<Delaunay> * mp;
|
||||
CGAL::Qt::GraphicsViewPolylineInput<K> * pi;
|
||||
CGAL::Qt::TriangulationCircumcircle<Delaunay> *tcc;
|
||||
public:
|
||||
MainWindow();
|
||||
|
||||
private:
|
||||
template <typename Iterator>
|
||||
void insert_polyline(Iterator b, Iterator e)
|
||||
{
|
||||
Point_2 p, q;
|
||||
Delaunay::Vertex_handle vh, wh;
|
||||
Iterator it = b;
|
||||
vh = dt.insert(*it);
|
||||
p = *it;
|
||||
++it;
|
||||
for(; it != e; ++it){
|
||||
q = *it;
|
||||
if(p != q){
|
||||
wh = dt.insert(*it);
|
||||
dt.insert_constraint(vh,wh);
|
||||
vh = wh;
|
||||
p = q;
|
||||
} else {
|
||||
std::cout << "duplicate point: " << p << std::endl;
|
||||
}
|
||||
}
|
||||
emit(changed());
|
||||
}
|
||||
|
||||
public slots:
|
||||
|
||||
void processInput(CGAL::Object o);
|
||||
|
||||
void on_actionMovingPoint_toggled(bool checked);
|
||||
|
||||
void on_actionShowDelaunay_toggled(bool checked);
|
||||
|
||||
void on_actionInsertPolyline_toggled(bool checked);
|
||||
|
||||
void on_actionCircumcenter_toggled(bool checked);
|
||||
|
||||
void on_actionClear_triggered();
|
||||
|
||||
void on_actionRecenter_triggered();
|
||||
|
||||
void on_actionLoadConstraints_triggered();
|
||||
|
||||
void loadConstraints(QString);
|
||||
|
||||
void on_actionSaveConstraints_triggered();
|
||||
|
||||
void saveConstraints(QString);
|
||||
|
||||
void on_actionInsertRandomPoints_triggered();
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
};
|
||||
|
||||
|
||||
MainWindow::MainWindow()
|
||||
: DemosMainWindow()
|
||||
{
|
||||
setupUi(this);
|
||||
|
|
@ -78,12 +183,12 @@ Constrained_Delaunay_triangulation_MainWindow::Constrained_Delaunay_triangulatio
|
|||
|
||||
this->setupStatusBar();
|
||||
this->setupOptionsMenu();
|
||||
this->addAboutDemo(":/cgal/help/about_constrained_Delaunay_triangulation.html");
|
||||
this->addAboutDemo(":/cgal/help/about_Constrained_Delaunay_triangulation_2.html");
|
||||
this->addAboutCGAL();
|
||||
}
|
||||
|
||||
void
|
||||
Constrained_Delaunay_triangulation_MainWindow::processInput(CGAL::Object o)
|
||||
MainWindow::processInput(CGAL::Object o)
|
||||
{
|
||||
std::list<Point_2> points;
|
||||
if(CGAL::assign(points, o)){
|
||||
|
|
@ -98,7 +203,7 @@ Constrained_Delaunay_triangulation_MainWindow::processInput(CGAL::Object o)
|
|||
}
|
||||
|
||||
void
|
||||
Constrained_Delaunay_triangulation_MainWindow::on_actionInsertPolyline_toggled(bool checked)
|
||||
MainWindow::on_actionInsertPolyline_toggled(bool checked)
|
||||
{
|
||||
if(checked){
|
||||
scene.installEventFilter(pi);
|
||||
|
|
@ -109,7 +214,7 @@ Constrained_Delaunay_triangulation_MainWindow::on_actionInsertPolyline_toggled(b
|
|||
|
||||
|
||||
void
|
||||
Constrained_Delaunay_triangulation_MainWindow::on_actionMovingPoint_toggled(bool checked)
|
||||
MainWindow::on_actionMovingPoint_toggled(bool checked)
|
||||
{
|
||||
|
||||
if(checked){
|
||||
|
|
@ -121,14 +226,14 @@ Constrained_Delaunay_triangulation_MainWindow::on_actionMovingPoint_toggled(bool
|
|||
|
||||
|
||||
void
|
||||
Constrained_Delaunay_triangulation_MainWindow::on_actionShowDelaunay_toggled(bool checked)
|
||||
MainWindow::on_actionShowDelaunay_toggled(bool checked)
|
||||
{
|
||||
dgi->setDrawEdges(checked);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Constrained_Delaunay_triangulation_MainWindow::on_actionCircumcenter_toggled(bool checked)
|
||||
MainWindow::on_actionCircumcenter_toggled(bool checked)
|
||||
{
|
||||
if(checked){
|
||||
scene.installEventFilter(tcc);
|
||||
|
|
@ -143,7 +248,7 @@ Constrained_Delaunay_triangulation_MainWindow::on_actionCircumcenter_toggled(boo
|
|||
|
||||
|
||||
void
|
||||
Constrained_Delaunay_triangulation_MainWindow::on_actionClear_triggered()
|
||||
MainWindow::on_actionClear_triggered()
|
||||
{
|
||||
dt.clear();
|
||||
emit(changed());
|
||||
|
|
@ -151,7 +256,7 @@ Constrained_Delaunay_triangulation_MainWindow::on_actionClear_triggered()
|
|||
|
||||
|
||||
void
|
||||
Constrained_Delaunay_triangulation_MainWindow::on_actionLoadConstraints_triggered()
|
||||
MainWindow::on_actionLoadConstraints_triggered()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open Constraint File"),
|
||||
|
|
@ -165,7 +270,7 @@ Constrained_Delaunay_triangulation_MainWindow::on_actionLoadConstraints_triggere
|
|||
|
||||
|
||||
void
|
||||
Constrained_Delaunay_triangulation_MainWindow::loadConstraints(QString fileName)
|
||||
MainWindow::loadConstraints(QString fileName)
|
||||
{
|
||||
std::ifstream ifs(qPrintable(fileName));
|
||||
|
||||
|
|
@ -181,14 +286,14 @@ Constrained_Delaunay_triangulation_MainWindow::loadConstraints(QString fileName)
|
|||
}
|
||||
|
||||
void
|
||||
Constrained_Delaunay_triangulation_MainWindow::on_actionRecenter_triggered()
|
||||
MainWindow::on_actionRecenter_triggered()
|
||||
{
|
||||
this->graphicsView->setSceneRect(dgi->boundingRect());
|
||||
this->graphicsView->fitInView(dgi->boundingRect(), Qt::KeepAspectRatio);
|
||||
}
|
||||
|
||||
void
|
||||
Constrained_Delaunay_triangulation_MainWindow::on_actionSaveConstraints_triggered()
|
||||
MainWindow::on_actionSaveConstraints_triggered()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(this,
|
||||
tr("Save Constraints"),
|
||||
|
|
@ -202,7 +307,7 @@ Constrained_Delaunay_triangulation_MainWindow::on_actionSaveConstraints_triggere
|
|||
|
||||
|
||||
void
|
||||
Constrained_Delaunay_triangulation_MainWindow::saveConstraints(QString fileName)
|
||||
MainWindow::saveConstraints(QString fileName)
|
||||
{
|
||||
QMessageBox::warning(this,
|
||||
tr("saveConstraints"),
|
||||
|
|
@ -210,7 +315,7 @@ Constrained_Delaunay_triangulation_MainWindow::saveConstraints(QString fileName)
|
|||
}
|
||||
|
||||
void
|
||||
Constrained_Delaunay_triangulation_MainWindow::on_actionInsertRandomPoints_triggered()
|
||||
MainWindow::on_actionInsertRandomPoints_triggered()
|
||||
{
|
||||
typedef CGAL::Creator_uniform_2<double,Point_2> Creator;
|
||||
CGAL::Random_points_in_disc_2<Point_2,Creator> g( 100.0);
|
||||
|
|
@ -229,4 +334,19 @@ Constrained_Delaunay_triangulation_MainWindow::on_actionInsertRandomPoints_trigg
|
|||
emit(changed());
|
||||
}
|
||||
|
||||
#include "Constrained_Delaunay_triangulation_MainWindow.moc"
|
||||
#include "Constrained_Delaunay_triangulation_2.moc"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
// import resources from libCGALQt4
|
||||
Q_INIT_RESOURCE(File);
|
||||
Q_INIT_RESOURCE(Triangulation_2);
|
||||
Q_INIT_RESOURCE(Input);
|
||||
Q_INIT_RESOURCE(Logos);
|
||||
|
||||
MainWindow mainWindow;
|
||||
mainWindow.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
<file>icons/movingPoint.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/cgal/help" lang="en" >
|
||||
<file>about_CGAL.html</file>
|
||||
<file>about_constrained_Delaunay_triangulation.html</file>
|
||||
<file alias="about_CGAL.html" >../resources/about_CGAL.html</file>
|
||||
<file>about_Constrained_Delaunay_triangulation_2.html</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<ui version="4.0" >
|
||||
<author>GeometryFactory</author>
|
||||
<class>Constrained_Delaunay_triangulation_MainWindow</class>
|
||||
<widget class="QMainWindow" name="Constrained_Delaunay_triangulation_MainWindow" >
|
||||
<class>Constrained_Delaunay_triangulation_2</class>
|
||||
<widget class="QMainWindow" name="Constrained_Delaunay_triangulation_2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
|
|
@ -82,7 +82,7 @@
|
|||
<rect>
|
||||
<x>116</x>
|
||||
<y>29</y>
|
||||
<width>184</width>
|
||||
<width>284</width>
|
||||
<height>37</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -174,7 +174,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="Constrained_Delaunay_triangulation_MainWindow.qrc" >
|
||||
<iconset resource="Constrained_Delaunay_triangulation_2.qrc" >
|
||||
<normaloff>:/cgal/Actions/icons/movingPoint.png</normaloff>:/cgal/Actions/icons/movingPoint.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
|
|
@ -288,7 +288,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="Constrained_Delaunay_triangulation_MainWindow.qrc" >
|
||||
<iconset resource="Constrained_Delaunay_triangulation_2.qrc" >
|
||||
<normaloff>:/cgal/Actions/icons/circumcenter.png</normaloff>:/cgal/Actions/icons/circumcenter.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
|
|
@ -312,7 +312,7 @@
|
|||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="Constrained_Delaunay_triangulation_MainWindow.qrc" />
|
||||
<include location="Constrained_Delaunay_triangulation_2.qrc" />
|
||||
<include location="../icons/File.qrc" />
|
||||
<include location="../icons/Logos.qrc" />
|
||||
<include location="../icons/Triangulation_2.qrc" />
|
||||
|
|
@ -1,6 +1,10 @@
|
|||
#include <fstream>
|
||||
#include "Delaunay_triangulation_MainWindow.h"
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Delaunay_triangulation_2.h>
|
||||
|
||||
#include <QtGui>
|
||||
#include <QString>
|
||||
#include <QActionGroup>
|
||||
#include <QFileDialog>
|
||||
#include <QInputDialog>
|
||||
|
|
@ -12,7 +16,77 @@
|
|||
#include <CGAL/Qt/TriangulationGraphicsItem.h>
|
||||
#include <CGAL/Qt/VoronoiGraphicsItem.h>
|
||||
|
||||
Delaunay_triangulation_MainWindow::Delaunay_triangulation_MainWindow()
|
||||
#include "ui_Delaunay_triangulation_2.h"
|
||||
#include <CGAL/Qt/DemosMainWindow.h>
|
||||
|
||||
// forward declarations
|
||||
namespace CGAL {
|
||||
namespace Qt {
|
||||
template <class Delaunay> class TriangulationGraphicsItem;
|
||||
template <class Delaunay> class VoronoiGraphicsItem;
|
||||
template <class Delaunay> class TriangulationMovingPoint;
|
||||
template <class Delaunay> class TriangulationCircumcircle;
|
||||
template <class K> class GraphicsViewPolylineInput;
|
||||
} // namespace Qt
|
||||
} // namespace CGAL
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef K::Point_2 Point_2;
|
||||
|
||||
typedef CGAL::Delaunay_triangulation_2<K> Delaunay;
|
||||
|
||||
class MainWindow :
|
||||
public CGAL::Qt::DemosMainWindow,
|
||||
public Ui::Delaunay_triangulation_2
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
Delaunay dt;
|
||||
QGraphicsScene scene;
|
||||
|
||||
CGAL::Qt::TriangulationGraphicsItem<Delaunay> * dgi;
|
||||
CGAL::Qt::VoronoiGraphicsItem<Delaunay> * vgi;
|
||||
|
||||
CGAL::Qt::TriangulationMovingPoint<Delaunay> * mp;
|
||||
CGAL::Qt::GraphicsViewPolylineInput<K> * pi;
|
||||
CGAL::Qt::TriangulationCircumcircle<Delaunay> *tcc;
|
||||
public:
|
||||
MainWindow();
|
||||
|
||||
public slots:
|
||||
|
||||
void processInput(CGAL::Object o);
|
||||
|
||||
void on_actionMovingPoint_toggled(bool checked);
|
||||
|
||||
void on_actionShowDelaunay_toggled(bool checked);
|
||||
|
||||
void on_actionShowVoronoi_toggled(bool checked);
|
||||
|
||||
void on_actionInsertPoint_toggled(bool checked);
|
||||
|
||||
void on_actionCircumcenter_toggled(bool checked);
|
||||
|
||||
void on_actionClear_triggered();
|
||||
|
||||
void on_actionRecenter_triggered();
|
||||
|
||||
void on_actionLoadConstraints_triggered();
|
||||
|
||||
void loadConstraints(QString);
|
||||
|
||||
void on_actionSaveConstraints_triggered();
|
||||
|
||||
void saveConstraints(QString);
|
||||
|
||||
void on_actionInsertRandomPoints_triggered();
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
};
|
||||
|
||||
MainWindow::MainWindow()
|
||||
: DemosMainWindow()
|
||||
{
|
||||
setupUi(this);
|
||||
|
|
@ -90,12 +164,12 @@ Delaunay_triangulation_MainWindow::Delaunay_triangulation_MainWindow()
|
|||
|
||||
this->setupStatusBar();
|
||||
this->setupOptionsMenu();
|
||||
this->addAboutDemo(":/cgal/help/about_Delaunay_triangulation.html");
|
||||
this->addAboutDemo(":/cgal/help/about_Delaunay_triangulation_2.html");
|
||||
this->addAboutCGAL();
|
||||
}
|
||||
|
||||
void
|
||||
Delaunay_triangulation_MainWindow::processInput(CGAL::Object o)
|
||||
MainWindow::processInput(CGAL::Object o)
|
||||
{
|
||||
std::list<Point_2> points;
|
||||
if(CGAL::assign(points, o)){
|
||||
|
|
@ -107,7 +181,7 @@ Delaunay_triangulation_MainWindow::processInput(CGAL::Object o)
|
|||
}
|
||||
|
||||
void
|
||||
Delaunay_triangulation_MainWindow::on_actionInsertPoint_toggled(bool checked)
|
||||
MainWindow::on_actionInsertPoint_toggled(bool checked)
|
||||
{
|
||||
if(checked){
|
||||
scene.installEventFilter(pi);
|
||||
|
|
@ -118,7 +192,7 @@ Delaunay_triangulation_MainWindow::on_actionInsertPoint_toggled(bool checked)
|
|||
|
||||
|
||||
void
|
||||
Delaunay_triangulation_MainWindow::on_actionMovingPoint_toggled(bool checked)
|
||||
MainWindow::on_actionMovingPoint_toggled(bool checked)
|
||||
{
|
||||
|
||||
if(checked){
|
||||
|
|
@ -130,19 +204,19 @@ Delaunay_triangulation_MainWindow::on_actionMovingPoint_toggled(bool checked)
|
|||
|
||||
|
||||
void
|
||||
Delaunay_triangulation_MainWindow::on_actionShowDelaunay_toggled(bool checked)
|
||||
MainWindow::on_actionShowDelaunay_toggled(bool checked)
|
||||
{
|
||||
dgi->setDrawEdges(checked);
|
||||
}
|
||||
|
||||
void
|
||||
Delaunay_triangulation_MainWindow::on_actionShowVoronoi_toggled(bool checked)
|
||||
MainWindow::on_actionShowVoronoi_toggled(bool checked)
|
||||
{
|
||||
vgi->setVisible(checked);
|
||||
}
|
||||
|
||||
void
|
||||
Delaunay_triangulation_MainWindow::on_actionCircumcenter_toggled(bool checked)
|
||||
MainWindow::on_actionCircumcenter_toggled(bool checked)
|
||||
{
|
||||
if(checked){
|
||||
scene.installEventFilter(tcc);
|
||||
|
|
@ -157,7 +231,7 @@ Delaunay_triangulation_MainWindow::on_actionCircumcenter_toggled(bool checked)
|
|||
|
||||
|
||||
void
|
||||
Delaunay_triangulation_MainWindow::on_actionClear_triggered()
|
||||
MainWindow::on_actionClear_triggered()
|
||||
{
|
||||
dt.clear();
|
||||
emit(changed());
|
||||
|
|
@ -165,7 +239,7 @@ Delaunay_triangulation_MainWindow::on_actionClear_triggered()
|
|||
|
||||
|
||||
void
|
||||
Delaunay_triangulation_MainWindow::on_actionLoadConstraints_triggered()
|
||||
MainWindow::on_actionLoadConstraints_triggered()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open Constraint File"),
|
||||
|
|
@ -179,7 +253,7 @@ Delaunay_triangulation_MainWindow::on_actionLoadConstraints_triggered()
|
|||
|
||||
|
||||
void
|
||||
Delaunay_triangulation_MainWindow::loadConstraints(QString fileName)
|
||||
MainWindow::loadConstraints(QString fileName)
|
||||
{
|
||||
std::ifstream ifs(qPrintable(fileName));
|
||||
|
||||
|
|
@ -193,14 +267,14 @@ Delaunay_triangulation_MainWindow::loadConstraints(QString fileName)
|
|||
}
|
||||
|
||||
void
|
||||
Delaunay_triangulation_MainWindow::on_actionRecenter_triggered()
|
||||
MainWindow::on_actionRecenter_triggered()
|
||||
{
|
||||
this->graphicsView->setSceneRect(dgi->boundingRect());
|
||||
this->graphicsView->fitInView(dgi->boundingRect(), Qt::KeepAspectRatio);
|
||||
}
|
||||
|
||||
void
|
||||
Delaunay_triangulation_MainWindow::on_actionSaveConstraints_triggered()
|
||||
MainWindow::on_actionSaveConstraints_triggered()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(this,
|
||||
tr("Save Constraints"),
|
||||
|
|
@ -214,7 +288,7 @@ Delaunay_triangulation_MainWindow::on_actionSaveConstraints_triggered()
|
|||
|
||||
|
||||
void
|
||||
Delaunay_triangulation_MainWindow::saveConstraints(QString fileName)
|
||||
MainWindow::saveConstraints(QString fileName)
|
||||
{
|
||||
QMessageBox::warning(this,
|
||||
tr("saveConstraints"),
|
||||
|
|
@ -222,7 +296,7 @@ Delaunay_triangulation_MainWindow::saveConstraints(QString fileName)
|
|||
}
|
||||
|
||||
void
|
||||
Delaunay_triangulation_MainWindow::on_actionInsertRandomPoints_triggered()
|
||||
MainWindow::on_actionInsertRandomPoints_triggered()
|
||||
{
|
||||
typedef CGAL::Creator_uniform_2<double,Point_2> Creator;
|
||||
CGAL::Random_points_in_disc_2<Point_2,Creator> g( 100.0);
|
||||
|
|
@ -241,4 +315,20 @@ Delaunay_triangulation_MainWindow::on_actionInsertRandomPoints_triggered()
|
|||
emit(changed());
|
||||
}
|
||||
|
||||
#include "Delaunay_triangulation_MainWindow.moc"
|
||||
#include "Delaunay_triangulation_2.moc"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
// import resources from libCGALQt4
|
||||
Q_INIT_RESOURCE(File);
|
||||
Q_INIT_RESOURCE(Triangulation_2);
|
||||
Q_INIT_RESOURCE(Input);
|
||||
Q_INIT_RESOURCE(Logos);
|
||||
|
||||
|
||||
MainWindow mainWindow;
|
||||
mainWindow.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
<file>icons/movingPoint.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/cgal/help" lang="en" >
|
||||
<file>about_CGAL.html</file>
|
||||
<file>about_Delaunay_triangulation.html</file>
|
||||
<file alias="about_CGAL.html" >../resources/about_CGAL.html</file>
|
||||
<file>about_Delaunay_triangulation_2.html</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<ui version="4.0" >
|
||||
<author>GeometryFactory</author>
|
||||
<class>Delaunay_triangulation_MainWindow</class>
|
||||
<widget class="QMainWindow" name="Delaunay_triangulation_MainWindow" >
|
||||
<class>Delaunay_triangulation_2</class>
|
||||
<widget class="QMainWindow" name="Delaunay_triangulation_2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
|
|
@ -82,7 +82,7 @@
|
|||
<rect>
|
||||
<x>116</x>
|
||||
<y>29</y>
|
||||
<width>218</width>
|
||||
<width>284</width>
|
||||
<height>37</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -174,7 +174,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="Delaunay_triangulation_MainWindow.qrc" >
|
||||
<iconset resource="Delaunay_triangulation_2.qrc" >
|
||||
<normaloff>:/cgal/Actions/icons/movingPoint.png</normaloff>:/cgal/Actions/icons/movingPoint.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
|
|
@ -285,7 +285,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="Delaunay_triangulation_MainWindow.qrc" >
|
||||
<iconset resource="Delaunay_triangulation_2.qrc" >
|
||||
<normaloff>:/cgal/Actions/icons/circumcenter.png</normaloff>:/cgal/Actions/icons/circumcenter.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
|
|
@ -309,7 +309,7 @@
|
|||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="Delaunay_triangulation_MainWindow.qrc" />
|
||||
<include location="Delaunay_triangulation_2.qrc" />
|
||||
<include location="../icons/File.qrc" />
|
||||
<include location="../icons/Logos.qrc" />
|
||||
<include location="../icons/Triangulation_2.qrc" />
|
||||
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
|
|
@ -15,7 +15,7 @@ The \ccc{Escape} key removes the last entered point.
|
|||
The template parameter of \ccRefName\ must be a \cgal\ \ccc{Kernel}.
|
||||
|
||||
\ccInheritsFrom
|
||||
\ccc{GraphicsViewInput}
|
||||
\ccc{Qt::GraphicsViewInput}
|
||||
|
||||
\ccGlue
|
||||
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ protected:
|
|||
DemosMainWindow (QWidget * parent = 0, ::Qt::WindowFlags flags = 0 );
|
||||
void setupStatusBar();
|
||||
void addNavigation(QGraphicsView*);
|
||||
void setupOptionsMenu(QMenu* menu = NULL);
|
||||
void addAboutCGAL(QMenu* menu = NULL);
|
||||
void addAboutDemo(QString htmlResourceName, QMenu* menu = NULL);
|
||||
void setupOptionsMenu(QMenu* menu = 0);
|
||||
void addAboutCGAL(QMenu* menu = 0);
|
||||
void addAboutDemo(QString htmlResourceName, QMenu* menu = 0);
|
||||
|
||||
protected slots:
|
||||
void setUseAntialiasing(bool checked);
|
||||
|
|
@ -23,6 +23,7 @@ find_package(CGAL REQUIRED)
|
|||
include(${CGAL_USE_FILE})
|
||||
|
||||
set( QT_USE_QTMAIN TRUE )
|
||||
set( QT_USE_QTOPENGL TRUE )
|
||||
find_package(Qt4 QUIET)
|
||||
|
||||
include_directories (BEFORE ../../include)
|
||||
|
|
@ -30,11 +31,10 @@ include_directories (BEFORE ../../include)
|
|||
if(QT4_FOUND)
|
||||
include(${QT_USE_FILE})
|
||||
|
||||
# a moc file that is included in a .cpp file
|
||||
qt4_generate_moc( ../../include/CGAL/Qt/GraphicsViewNavigation.h GraphicsViewNavigation.moc )
|
||||
macro_add_file_dependencies( GraphicsViewNavigation.cpp GraphicsViewNavigation.moc )
|
||||
|
||||
# two moc files that are compiled directly as cpp files
|
||||
# moc files that are compiled directly as cpp files
|
||||
qt4_generate_moc( ../../include/CGAL/Qt/GraphicsViewNavigation.h GraphicsViewNavigation_moc.cpp )
|
||||
qt4_generate_moc( ../../include/CGAL/Qt/DemosMainWindow.h DemosMainWindow_moc.cpp )
|
||||
qt4_generate_moc( ../../include/CGAL/Qt/GraphicsItem.h GraphicsItem_moc.cpp )
|
||||
qt4_generate_moc( ../../include/CGAL/Qt/GraphicsViewInput.h GraphicsViewInput_moc.cpp )
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ if(QT4_FOUND)
|
|||
|
||||
set( CGAL_QT4_BASENAME CGAL-Qt4 )
|
||||
|
||||
add_library( CGAL_QT4 GraphicsViewInput_moc.cpp GraphicsViewNavigation.cpp GraphicsItem_moc.cpp GraphicsViewPolylineInput.cpp ${RESOURCE_FILES} )
|
||||
add_library( CGAL_QT4 GraphicsViewInput_moc.cpp GraphicsViewNavigation.cpp GraphicsViewNavigation_moc.cpp GraphicsItem_moc.cpp GraphicsViewPolylineInput.cpp DemosMainWindow.cpp DemosMainWindow_moc.cpp ${RESOURCE_FILES} )
|
||||
target_link_libraries( CGAL_QT4 ${QT_LIBRARIES} )
|
||||
if ( NOT AUTO_LINK_ENABLED )
|
||||
# If auto-link is not enabled (on Linux for example), link with libCGAL explicitly.
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include <QGLWidget>
|
||||
#include <QTextStream>
|
||||
|
||||
#include "DemosMainWindow.h"
|
||||
#include <CGAL/Qt/DemosMainWindow.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Qt {
|
||||
|
|
@ -215,5 +215,3 @@ DemosMainWindow::popupAboutDemo()
|
|||
|
||||
} // namespace Qt
|
||||
} // namespace CGAL
|
||||
|
||||
#include "DemosMainWindow.moc"
|
||||
|
|
@ -81,6 +81,9 @@ namespace Qt {
|
|||
case ::Qt::Key_Minus:
|
||||
scaleView(v, 1 / 1.2);
|
||||
break;
|
||||
case ::Qt::Key_Control:
|
||||
cursor_backup = v->cursor();
|
||||
v->setCursor(::Qt::CrossCursor);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
@ -90,11 +93,13 @@ namespace Qt {
|
|||
} // end case KeyPress
|
||||
case QEvent::KeyRelease: {
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
|
||||
if(keyEvent->key() == ::Qt::Key_Control && rectItem->isVisible() ) {
|
||||
if(keyEvent->key() == ::Qt::Key_Control) {
|
||||
if(rectItem->isVisible() ) {
|
||||
dragging = false;
|
||||
v->setCursor(cursor_backup);
|
||||
v->scene()->removeItem(rectItem);
|
||||
rectItem->hide();
|
||||
}
|
||||
v->setCursor(cursor_backup);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -136,7 +141,6 @@ namespace Qt {
|
|||
else if( mouseEvent->button() == ::Qt::RightButton) {
|
||||
dragging = true;
|
||||
dragging_start = v->mapToScene(mouseEvent->pos());
|
||||
cursor_backup = v->cursor();
|
||||
v->setCursor(::Qt::ClosedHandCursor);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -308,8 +312,6 @@ namespace Qt {
|
|||
% v->verticalScrollBar()->maximum();
|
||||
}
|
||||
|
||||
#include "GraphicsViewNavigation.moc"
|
||||
|
||||
} // namespace Qt
|
||||
} // namespace CGAL
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue