Merge pull request #154 from maxGimeno/CGAL-Qt5_support-GF

Qt5 support, GSoC 2014

https://cgal.geometryfactory.com/CGAL/Members/wiki/Features/Small_Features/Qt5_support

In this commit, I have fixed the permissions of the file:
	Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/data/points

In this commit, I have also modified:
	Installation/changes.html
This commit is contained in:
Laurent Rineau 2015-07-17 13:43:49 +02:00
commit aa72eaa371
438 changed files with 24303 additions and 15464 deletions

16
.gitignore vendored
View File

@ -189,12 +189,12 @@ GraphicsView/demo/Triangulation_2/Makefile
GraphicsView/demo/Triangulation_2/Regular_triangulation_2
GraphicsView/demo/Triangulation_2/qrc_*.cxx
GraphicsView/demo/Triangulation_2/ui_*.h
GraphicsView/src/CGAL_Qt4/*.dll
GraphicsView/src/CGAL_Qt4/*.lib
GraphicsView/src/CGAL_Qt4/*.so
GraphicsView/src/CGAL_Qt4/Makefile
GraphicsView/src/CGAL_Qt4/moc_*.cxx
GraphicsView/src/CGAL_Qt4/qrc_*.cxx
GraphicsView/src/CGAL_Qt5/*.dll
GraphicsView/src/CGAL_Qt5/*.lib
GraphicsView/src/CGAL_Qt5/*.so
GraphicsView/src/CGAL_Qt5/Makefile
GraphicsView/src/CGAL_Qt5/moc_*.cxx
GraphicsView/src/CGAL_Qt5/qrc_*.cxx
HalfedgeDS/test/HalfedgeDS/CMakeLists.txt
HalfedgeDS/test/HalfedgeDS/cgal_test_with_cmake
HalfedgeDS/test/HalfedgeDS/test_hds
@ -826,7 +826,7 @@ Surface_mesher/demo/Surface_mesher/.*.deps
Surface_mesher/demo/Surface_mesher/.qglviewer.xml
Surface_mesher/demo/Surface_mesher/Makefile
Surface_mesher/demo/Surface_mesher/Surface_mesher
Surface_mesher/demo/Surface_mesher/Surface_mesher_Qt4_Demo
Surface_mesher/demo/Surface_mesher/Surface_mesher_Qt5_Demo
Surface_mesher/demo/Surface_mesher/VTK/Makefile
Surface_mesher/demo/Surface_mesher/VTK/mesh_a_3D_image
Surface_mesher/demo/Surface_mesher/VTK/mesh_a_VTK_3D_image
@ -841,7 +841,7 @@ Surface_mesher/demo/Surface_mesher/out*.off
Surface_mesher/demo/Surface_mesher/polyhedron_remesher
Surface_mesher/demo/Surface_mesher/polyhedron_remesher_with_edges
Surface_mesher/demo/Surface_mesher/qrc_*.c*
Surface_mesher/demo/Surface_mesher/qt4-demo
Surface_mesher/demo/Surface_mesher/qt5-demo
Surface_mesher/demo/Surface_mesher/ui_*.h
Surface_mesher/doxygen
Surface_mesher/examples/Surface_mesher/.*.deps

View File

@ -26,6 +26,8 @@
#include "MainWindow.h"
#include <QApplication>
#include <CGAL/Qt/resources.h>
#include <QMimeData>
int main(int argc, char **argv)
{
@ -33,10 +35,11 @@ int main(int argc, char **argv)
app.setOrganizationDomain("inria.fr");
app.setOrganizationName("INRIA");
app.setApplicationName("AABB tree demo");
//for windows
app.setAttribute(Qt::AA_UseDesktopOpenGL);
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGALQt (Qt5).
CGAL_QT_INIT_RESOURCES;
MainWindow mainWindow;
mainWindow.show();

View File

@ -2,61 +2,57 @@
project( AABB_demo )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
# Include this package's headers first
include_directories( BEFORE ./ ./include ../../include )
# Find CGAL and CGAL Qt4
find_package(CGAL COMPONENTS Qt4)
# Find CGAL and CGAL Qt5
find_package(CGAL COMPONENTS Qt5 )
include( ${CGAL_USE_FILE} )
# Find Qt4 itself
set( QT_USE_QTXML TRUE )
set( QT_USE_QTMAIN TRUE )
set( QT_USE_QTSCRIPT TRUE )
set( QT_USE_QTOPENGL TRUE )
find_package(Qt4)
# Find Qt5 itself
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Gui Svg)
# Find OpenGL
find_package(OpenGL)
# Find QGLViewer
if(QT4_FOUND)
include(${QT_USE_FILE})
if(Qt5_FOUND)
find_package(QGLViewer )
endif(QT4_FOUND)
endif(Qt5_FOUND)
if(CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
include_directories ( ${QGLVIEWER_INCLUDE_DIR} )
qt4_wrap_ui( UI_FILES MainWindow.ui )
qt5_wrap_ui( UI_FILES MainWindow.ui )
include(AddFileDependencies)
qt4_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" )
qt5_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" )
add_file_dependencies( MainWindow_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.h" )
qt4_generate_moc( "Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" )
qt5_generate_moc( "Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" )
add_file_dependencies( Viewer_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Viewer.h" )
qt4_generate_moc( "Scene.h" "${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp" )
qt5_generate_moc( "Scene.h" "${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp" )
add_file_dependencies( Scene_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Scene.h" )
qt4_add_resources ( RESOURCE_FILES AABB_demo.qrc )
qt5_add_resources ( RESOURCE_FILES AABB_demo.qrc )
add_file_dependencies( AABB_demo.cpp "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp" )
add_executable ( AABB_demo AABB_demo.cpp ${UI_FILES} ${RESOURCE_FILES} )
qt5_use_modules(AABB_demo Gui OpenGL Xml Script Svg )
# Link with Qt libraries
target_link_libraries( AABB_demo ${QT_LIBRARIES} )
@ -69,7 +65,7 @@ if(CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FO
add_to_cached_list( CGAL_EXECUTABLE_TARGETS AABB_demo )
else (CGAL_FOUND AND CGAL_CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
else (CGAL_FOUND AND CGAL_CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
set(AABB_MISSING_DEPS "")
@ -77,12 +73,12 @@ else (CGAL_FOUND AND CGAL_CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLV
set(AABB_MISSING_DEPS "the CGAL library, ${AABB_MISSING_DEPS}")
endif()
if(NOT CGAL_Qt4_FOUND)
set(AABB_MISSING_DEPS "the CGAL Qt4 library, ${AABB_MISSING_DEPS}")
if(NOT CGAL_Qt5_FOUND)
set(AABB_MISSING_DEPS "the CGAL Qt5 library, ${AABB_MISSING_DEPS}")
endif()
if(NOT QT4_FOUND)
set(AABB_MISSING_DEPS "Qt4, ${AABB_MISSING_DEPS}")
if(NOT Qt5_FOUND)
set(AABB_MISSING_DEPS "Qt5, ${AABB_MISSING_DEPS}")
endif()
if(NOT OPENGL_FOUND)
@ -95,4 +91,4 @@ else (CGAL_FOUND AND CGAL_CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLV
message(STATUS "NOTICE: This demo requires ${AABB_MISSING_DEPS}and will not be compiled.")
endif (CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)

View File

@ -27,11 +27,10 @@ MainWindow::MainWindow(QWidget* parent)
// accepts drop events
setAcceptDrops(true);
// setups scene
m_pScene = new Scene;
m_pScene = new Scene();
m_pViewer->setScene(m_pScene);
m_pViewer->setManipulatedFrame(m_pScene->manipulatedFrame());
m_pViewer->setManipulatedFrame(m_pScene->manipulatedFrame());
// connects actionQuit (Ctrl+Q) and qApp->quit()
connect(ui->actionQuit, SIGNAL(triggered()),
@ -154,9 +153,11 @@ void MainWindow::setAddKeyFrameKeyboardModifiers(::Qt::KeyboardModifiers m)
void MainWindow::on_actionInside_points_triggered()
{
bool ok;
const unsigned int nb_points = (unsigned)
QInputDialog::getInteger(NULL, "#Points",
QInputDialog::getInt(NULL, "#Points",
"#Points:",10000,1,100000000,9,&ok);
if(!ok)
return;
@ -169,9 +170,11 @@ void MainWindow::on_actionInside_points_triggered()
void MainWindow::on_actionPoints_in_interval_triggered()
{
bool ok;
const unsigned int nb_points = (unsigned)
QInputDialog::getInteger(NULL, "#Points",
QInputDialog::getInt(NULL, "#Points",
"#Points:",10000,1,100000000,9,&ok);
if(!ok)
return;
@ -195,9 +198,11 @@ void MainWindow::on_actionPoints_in_interval_triggered()
void MainWindow::on_actionBoundary_segments_triggered()
{
bool ok;
const unsigned int nb_slices = (unsigned)
QInputDialog::getInteger(NULL, "#Slices",
QInputDialog::getInt(NULL, "#Slices",
"Slices:",100,1,1000000,8,&ok);
if(!ok)
return;
@ -210,9 +215,11 @@ void MainWindow::on_actionBoundary_segments_triggered()
void MainWindow::on_actionBoundary_points_triggered()
{
bool ok;
const unsigned int nb_points = (unsigned)
QInputDialog::getInteger(NULL, "#Points",
QInputDialog::getInt(NULL, "#Points",
"Points:",1000,1,10000000,8,&ok);
if(!ok)
return;
@ -225,9 +232,11 @@ void MainWindow::on_actionBoundary_points_triggered()
void MainWindow::on_actionEdge_points_triggered()
{
bool ok;
const unsigned int nb_points = (unsigned)
QInputDialog::getInteger(NULL, "#Points",
QInputDialog::getInt(NULL, "#Points",
"Points:",1000,1,10000000,8,&ok);
if(!ok)
return;

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,39 @@
#include <QtCore/qglobal.h>
#include <QGLViewer/manipulatedFrame.h>
#include <QGLViewer/qglviewer.h>
#include <QOpenGLFunctions_3_3_Core>
#include <QOpenGLVertexArrayObject>
#include <QOpenGLBuffer>
#include <QOpenGLShaderProgram>
#include <QOpenGLTexture>
class Texture{
private:
int Width;
int Height;
int size;
GLubyte *data;
public:
Texture(int w, int h)
{
Width = w;
Height = h;
size = 3*Height*Width;
data = new GLubyte[Height*Width*3];
}
int getWidth() const {return Width;}
int getHeight() const {return Height;}
int getSize() const {return size;}
void setData(int i, int j, int r, int g, int b){
data[3*(Width*j+i) + 0] = r;
data[3*(Width*j+i) + 1] = g;
data[3*(Width*j+i) + 2] = b;
}
GLubyte* getData(){return data; }
};
class Viewer;
class Scene : public QObject
{
Q_OBJECT
@ -45,13 +77,16 @@ private:
};
public:
void draw();
QGLContext* context;
void draw(QGLViewer*);
void update_bbox();
Bbox bbox() { return m_bbox; }
ManipulatedFrame* manipulatedFrame() const { return m_frame; }
void initGL(Viewer *viewer);
private:
// member data
QOpenGLFunctions_3_3_Core *gl;
Bbox m_bbox;
Polyhedron *m_pPolyhedron;
std::list<Point> m_points;
@ -77,6 +112,7 @@ private:
Edge_tree m_edge_tree;
Cut_planes_types m_cut_plane;
bool are_buffers_initialized;
private:
// utility functions
@ -94,20 +130,55 @@ private:
void build_edge_tree();
void clear_internal_data();
void update_grid_size();
template <typename Tree>
void compute_distance_function(const Tree& tree);
template <typename Tree>
void sign_distance_function(const Tree& tree);
//Shaders elements
int poly_vertexLocation;
int tex_Location;
int points_vertexLocation;
int lines_vertexLocation;
int mvpLocation;
int tex_mvpLocation;
int fLocation;
int tex_fLocation;
int colorLocation;
std::vector<float> pos_points;
std::vector<float> pos_grid;
std::vector<float> pos_lines;
std::vector<float> pos_poly;
std::vector<float> pos_plane;
std::vector<float> pos_cut_segments;
std::vector<float> tex_map;
GLuint textureId;
Texture *texture;
GLint sampler_location;
QOpenGLBuffer buffers[10];
QOpenGLVertexArrayObject vao[10];
QOpenGLShaderProgram tex_rendering_program;
QOpenGLShaderProgram rendering_program;
void initialize_buffers();
void compute_elements(int mode);
void attrib_buffers(QGLViewer*);
void compile_shaders();
void compute_texture(int, int, Color_ramp, Color_ramp);
public:
// file menu
int open(QString filename);
// edit menu
void clear_points() { m_points.clear(); }
void clear_segments() { m_segments.clear(); }
void clear_points() { m_points.clear(); changed(); }
void clear_segments() { m_segments.clear(); changed(); }
void clear_cutting_plane();
// fast distance setter
@ -174,14 +245,6 @@ public:
void bench_closest_point_and_primitive(Facet_tree& tree,const double duration);
void bench_distance(Facet_tree& tree,const int function,const double duration);
// drawing
void draw_points();
void draw_segments();
void draw_polyhedron();
void draw_distance_function(const Color_ramp& ramp_pos,
const Color_ramp& ramp_neg) const;
void draw_cut_segment_plane() const;
// cutting plane activation/deactivation
void activate_cutting_plane();
void deactivate_cutting_plane();
@ -189,7 +252,7 @@ public:
public slots:
// cutting plane
void cutting_plane();
void changed();
}; // end class Scene
#endif // SCENE_H

View File

@ -1,13 +1,14 @@
#include "Viewer.h"
#include "Scene.h"
#include <QMouseEvent>
#include <QGLFunctions>
#include <CGAL/Qt/CreateOpenGLContext.h>
Viewer::Viewer(QWidget* parent)
: QGLViewer(parent),
: QGLViewer(CGAL::Qt::createOpenGLContext(),parent),
m_pScene(NULL),
m_custom_mouse(false)
{
setBackgroundColor(::Qt::white);
}
void Viewer::setScene(Scene* pScene)
@ -20,14 +21,16 @@ void Viewer::draw()
QGLViewer::draw();
if(m_pScene != NULL)
{
::glClearColor(1.0f,1.0f,1.0f,0.0f);
m_pScene->draw();
m_pScene->draw(this);
}
}
void Viewer::initializeGL()
{
QGLViewer::initializeGL();
setBackgroundColor(::Qt::white);
m_pScene->initGL(this);
}
void Viewer::mousePressEvent(QMouseEvent* e)
@ -60,4 +63,3 @@ void Viewer::mouseReleaseEvent(QMouseEvent* e)
QGLViewer::mouseReleaseEvent(e);
}

View File

@ -3,11 +3,11 @@
#include <QGLViewer/qglviewer.h>
// forward declarations
class QWidget;
class Scene;
class Viewer : public QGLViewer {
class Viewer : public QGLViewer{
Q_OBJECT

View File

@ -1,30 +0,0 @@
#ifndef _GL_RENDER_EDGES_
#define _GL_RENDER_EDGES_
#include <CGAL/gl.h>
template <class Polyhedron>
void gl_render_edges(Polyhedron& polyhedron)
{
typedef typename Polyhedron::Traits Kernel;
typedef typename Kernel::Point_3 Point;
::glBegin(GL_LINES);
typename Polyhedron::Edge_iterator he;
for(he = polyhedron.edges_begin();
he != polyhedron.edges_end();
he++)
{
const Point& a = he->vertex()->point();
const Point& b = he->opposite()->vertex()->point();
::glVertex3d(a.x(),a.y(),a.z());
::glVertex3d(b.x(),b.y(),b.z());
}
::glEnd();
}
#endif // _GL_RENDER_EDGES_

View File

@ -23,12 +23,15 @@
#include <CGAL/Bbox_3.h>
#include <CGAL/gl.h>
#include <vector>
namespace CGAL {
template<typename Primitive, typename Node>
struct AABB_drawing_traits
{
std::vector<float> *v_edges;
typedef CGAL::Bbox_3 Bbox;
bool go_further() { return true; }
@ -45,7 +48,7 @@ struct AABB_drawing_traits
}
// draw bbox
static void gl_draw(const Bbox& bb)
void gl_draw(const Bbox& bb)
{
::glBegin(GL_LINES);
gl_draw_edge(bb.xmin(), bb.ymin(), bb.zmin(),
@ -79,11 +82,16 @@ struct AABB_drawing_traits
::glEnd();
}
static void gl_draw_edge(double px, double py, double pz,
void gl_draw_edge(double px, double py, double pz,
double qx, double qy, double qz)
{
::glVertex3d(px,py,pz);
::glVertex3d(qx,qy,qz);
v_edges->push_back((float)px);
v_edges->push_back((float)py);
v_edges->push_back((float)pz);
v_edges->push_back((float)qx);
v_edges->push_back((float)qy);
v_edges->push_back((float)qz);
}
}; // AABB_drawing_traits

View File

@ -4,12 +4,8 @@
project( Algebraic_kernel_d_test )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()
cmake_minimum_required(VERSION 2.8.11)
find_package(CGAL QUIET COMPONENTS Core MPFI)

View File

@ -3,12 +3,8 @@
project( Algebraic_kernel_d_test )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()
cmake_minimum_required(VERSION 2.8.11)
# CGAL and its components
find_package( CGAL QUIET COMPONENTS Core RS3)
@ -26,7 +22,7 @@ include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
# Boost and its components
find_package( Boost REQUIRED )
find_package( Boost )
if ( NOT Boost_FOUND )

View File

@ -9,7 +9,7 @@ include( ${CGAL_USE_FILE} )
find_package(Qt3-patched)
# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so
# that it can be used together with FindQt4: all its variables are prefixed
# that it can be used together with Qt5: all its variables are prefixed
# by "QT3_" instead of "QT_".
if ( CGAL_FOUND AND QT3_FOUND AND CGAL_Qt3_FOUND)

View File

@ -13,10 +13,13 @@ int main(int argc, char** argv)
application.setOrganizationDomain("geometryfactory.com");
application.setOrganizationName("GeometryFactory");
application.setApplicationName("Alpha Shape Reconstruction");
//for Windows
application.setAttribute(Qt::AA_UseDesktopOpenGL);
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGALQt (Qt5).
// See http://doc.qt.io/qt-5/qdir.html#Q_INIT_RESOURCE
CGAL_QT_INIT_RESOURCES;
Q_INIT_RESOURCE(Alpha_shape_3);
MainWindow mw;

View File

@ -2,45 +2,40 @@
# This is the CMake script for compiling a CGAL application.
project (Alpha_shape_3)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4)
find_package(CGAL COMPONENTS Qt5)
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)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
find_package(OpenGL)
find_package(QGLViewer)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
# include(${QT_USE_FILE})
include_directories (${QGLVIEWER_INCLUDE_DIR})
include_directories (BEFORE ../../include ./ )
# ui file, created wih Qt Designer
qt4_wrap_ui( uis MainWindow.ui )
qt5_wrap_ui( uis MainWindow.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( RESOURCE_FILES ./Alpha_shape_3.qrc )
qt4_automoc( MainWindow.cpp Viewer.cpp)
qt5_add_resources ( RESOURCE_FILES ./Alpha_shape_3.qrc )
add_executable ( Alpha_shape_3 Alpha_shape_3.cpp MainWindow.cpp Viewer.cpp ${uis} ${RESOURCE_FILES} )
qt5_use_modules(Alpha_shape_3 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Alpha_shape_3 )
target_link_libraries( Alpha_shape_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
@ -49,6 +44,6 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_
else()
message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, OpenGL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, OpenGL and Qt5, and will not be compiled.")
endif()

View File

@ -74,6 +74,7 @@ MainWindow::alphaChanged(int i)
} else {
scene.alpha_shape.set_alpha(0);
}
viewer->alphaChanged();
Q_EMIT(alphaChanged());
}
@ -103,6 +104,7 @@ MainWindow::open(QString fileName)
this->addToRecentFiles(fileName);
QApplication::restoreOverrideCursor();
viewer->changed();
Q_EMIT(sceneChanged());
}

View File

@ -2,8 +2,268 @@
#include <vector>
#include <CGAL/bounding_box.h>
#include <QGLViewer/vec.h>
#include "CGAL/Qt/CreateOpenGLContext.h"
Viewer::Viewer(QWidget* parent)
: QGLViewer(CGAL::Qt::createOpenGLContext(),parent)
{
are_buffers_initialized = false;
}
void Viewer::compile_shaders()
{
initializeOpenGLFunctions();
if(! buffers[0].create() || !buffers[1].create() || !buffers[2].create() )
{
std::cerr<<"VBO Creation FAILED"<<std::endl;
}
if(!vao[0].create() || !vao[1].create() )
{
std::cerr<<"VAO Creation FAILED"<<std::endl;
}
//Facets
//Vertex source code
const char vertex_source[] =
{
"#version 330 \n"
"in highp vec4 vertex;\n"
"in highp vec3 normal;\n"
"uniform highp mat4 mvp_matrix;\n"
"uniform highp mat4 mv_matrix; \n"
"out highp vec4 fP; \n"
"out highp vec3 fN; \n"
"void main(void)\n"
"{\n"
" fP = mv_matrix * vertex; \n"
" fN = mat3(mv_matrix)* normal; \n"
" gl_Position = mvp_matrix * vertex;\n"
"}"
};
//Vertex source code
const char fragment_source[] =
{
"#version 330 \n"
"in highp vec4 fP; \n"
"in highp vec3 fN; \n"
"uniform highp vec4 color; \n"
"uniform vec4 light_pos; \n"
"uniform vec4 light_diff; \n"
"uniform vec4 light_spec; \n"
"uniform vec4 light_amb; \n"
"uniform float spec_power ; \n"
"void main(void) { \n"
" vec3 L = light_pos.xyz - fP.xyz; \n"
" vec3 V = -fP.xyz; \n"
" vec3 N = normalize(fN); \n"
" L = normalize(L); \n"
" V = normalize(V); \n"
" vec3 R = reflect(-L, N); \n"
" vec4 diffuse = abs(dot(N,L)) * light_diff * color; \n"
" vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n"
"gl_FragColor = light_amb*color + diffuse + specular ; \n"
"} \n"
"\n"
};
QOpenGLShader *vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
if(!vertex_shader->compileSourceCode(vertex_source))
{
std::cerr<<"Compiling vertex source FAILED"<<std::endl;
}
QOpenGLShader *fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
if(!fragment_shader->compileSourceCode(fragment_source))
{
std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
}
if(!rendering_program.addShader(vertex_shader))
{
std::cerr<<"adding vertex shader FAILED"<<std::endl;
}
if(!rendering_program.addShader(fragment_shader))
{
std::cerr<<"adding fragment shader FAILED"<<std::endl;
}
if(!rendering_program.link())
{
std::cerr<<"linking Program FAILED"<<std::endl;
}
rendering_program.bind();
//Points
//Vertex source code
const char vertex_source_points[] =
{
"#version 330 \n"
"in highp vec4 vertex;\n"
"uniform highp mat4 mvp_matrix;\n"
"void main(void)\n"
"{\n"
" gl_Position = mvp_matrix * vertex;\n"
"}"
};
//Vertex source code
const char fragment_source_points[] =
{
"#version 330 \n"
"uniform highp vec4 color; \n"
"void main(void) { \n"
"gl_FragColor = color; \n"
"} \n"
"\n"
};
vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
if(!vertex_shader->compileSourceCode(vertex_source_points))
{
std::cerr<<"Compiling vertex source FAILED"<<std::endl;
}
fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
if(!fragment_shader->compileSourceCode(fragment_source_points))
{
std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
}
if(!rendering_program_points.addShader(vertex_shader))
{
std::cerr<<"adding vertex shader FAILED"<<std::endl;
}
if(!rendering_program_points.addShader(fragment_shader))
{
std::cerr<<"adding fragment shader FAILED"<<std::endl;
}
if(!rendering_program_points.link())
{
std::cerr<<"linking Program FAILED"<<std::endl;
}
rendering_program_points.bind();
}
void Viewer::initialize_buffers()
{
vao[0].bind();
buffers[0].bind();
buffers[0].allocate(pos_poly.data(),
static_cast<int>(pos_poly.size()*sizeof(float)));
poly_vertexLocation = rendering_program.attributeLocation("vertex");
rendering_program.bind();
rendering_program.enableAttributeArray(poly_vertexLocation);
rendering_program.setAttributeBuffer(poly_vertexLocation,GL_FLOAT,0,3);
buffers[0].release();
buffers[1].bind();
buffers[1].allocate(normals.data(),
static_cast<int>(normals.size()*sizeof(float)));
normalsLocation = rendering_program.attributeLocation("normal");
rendering_program.bind();
rendering_program.enableAttributeArray(normalsLocation);
rendering_program.setAttributeBuffer(normalsLocation,GL_FLOAT,0,3);
buffers[1].release();
rendering_program.release();
vao[0].release();
vao[1].bind();
buffers[2].bind();
buffers[2].allocate(pos_points.data(),
static_cast<int>(pos_points.size()*sizeof(float)));
points_vertexLocation = rendering_program_points.attributeLocation("vertex");
rendering_program_points.bind();
rendering_program_points.enableAttributeArray(points_vertexLocation);
rendering_program_points.setAttributeBuffer(points_vertexLocation,GL_FLOAT,0,3);
buffers[2].release();
rendering_program_points.release();
vao[0].release();
are_buffers_initialized = true;
}
void Viewer::attrib_buffers(QGLViewer* viewer)
{
QMatrix4x4 mvpMatrix;
QMatrix4x4 mvMatrix;
double mat[16];
viewer->camera()->getModelViewProjectionMatrix(mat);
for(int i=0; i < 16; i++)
{
mvpMatrix.data()[i] = (float)mat[i];
}
viewer->camera()->getModelViewMatrix(mat);
for(int i=0; i < 16; i++)
{
mvMatrix.data()[i] = (float)mat[i];
}
// define material
QVector4D ambient(0.25f, 0.20725f, 0.20725f, 0.922f);
QVector4D diffuse( 1.0f,
0.829f,
0.829f,
0.922f );
QVector4D specular( 0.6f,
0.6f,
0.6f,
1.0f );
QVector4D position(0.0f,0.0f,1.0f,1.0f );
GLfloat shininess = 11.264f;
rendering_program.bind();
mvpLocation = rendering_program.uniformLocation("mvp_matrix");
mvLocation = rendering_program.uniformLocation("mv_matrix");
colorLocation = rendering_program.uniformLocation("color");
lightLocation[0] = rendering_program.uniformLocation("light_pos");
lightLocation[1] = rendering_program.uniformLocation("light_diff");
lightLocation[2] = rendering_program.uniformLocation("light_spec");
lightLocation[3] = rendering_program.uniformLocation("light_amb");
lightLocation[4] = rendering_program.uniformLocation("spec_power");
rendering_program.setUniformValue(lightLocation[0], position);
rendering_program.setUniformValue(lightLocation[1], diffuse);
rendering_program.setUniformValue(lightLocation[2], specular);
rendering_program.setUniformValue(lightLocation[3], ambient);
rendering_program.setUniformValue(lightLocation[4], shininess);
rendering_program.setUniformValue(mvpLocation, mvpMatrix);
rendering_program.setUniformValue(mvLocation, mvMatrix);
rendering_program.release();
rendering_program_points.bind();
mvpLocation_points = rendering_program_points.uniformLocation("mvp_matrix");
colorLocation_points = rendering_program_points.uniformLocation("color");
rendering_program_points.setUniformValue(mvpLocation_points, mvpMatrix);
rendering_program_points.release();
}
void Viewer::initializeGL()
{
QGLViewer::initializeGL();
compile_shaders();
}
void
@ -16,123 +276,114 @@ Viewer::sceneChanged()
qglviewer::Vec(bb.xmax(),
bb.ymax(),
bb.zmax()));
this->showEntireScene();
}
void Viewer::compute_elements()
{
normals.resize(0);
pos_points.resize(0);
pos_poly.resize(0);
for(std::list<Point_3>::iterator it = scene->points.begin();
it != scene->points.end();
++it){
pos_points.push_back(it->x()); pos_points.push_back(it->y()); pos_points.push_back(it->z());
}
std::list<Facet> facets;
scene->alpha_shape.get_alpha_shape_facets(std::back_inserter(facets), Alpha_shape_3::REGULAR);
for(std::list<Facet>::iterator fit = facets.begin();
fit != facets.end();
++fit) {
const Cell_handle& ch = fit->first;
const int index = fit->second;
//const Vector_3& n = ch->normal(index); // must be unit vector
const Point_3& a = ch->vertex((index+1)&3)->point();
const Point_3& b = ch->vertex((index+2)&3)->point();
const Point_3& c = ch->vertex((index+3)&3)->point();
Vector_3 v = CGAL::unit_normal(a,b,c);
normals.push_back(v.x()); normals.push_back(v.y()); normals.push_back(v.z());
normals.push_back(v.x()); normals.push_back(v.y()); normals.push_back(v.z());
normals.push_back(v.x()); normals.push_back(v.y()); normals.push_back(v.z());
pos_poly.push_back(a.x()); pos_poly.push_back(a.y()); pos_poly.push_back(a.z());
pos_poly.push_back(b.x()); pos_poly.push_back(b.y()); pos_poly.push_back(b.z());
pos_poly.push_back(c.x()); pos_poly.push_back(c.y()); pos_poly.push_back(c.z());
}
}
void
Viewer::draw()
{
// define material
float ambient[] = { 0.25f,
0.20725f,
0.20725f,
0.922f };
float diffuse[] = { 1.0f,
0.829f,
0.829f,
0.922f };
float specular[] = { 0.296648f,
0.296648f,
0.296648f,
0.522f };
float emission[] = { 0.3f,
0.3f,
0.3f,
1.0f };
float shininess[] = { 11.264f };
// apply material
::glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, ambient);
::glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse);
::glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, specular);
::glMaterialfv( GL_FRONT_AND_BACK, GL_SHININESS, shininess);
::glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, emission);
// anti-aliasing (if the OpenGL driver permits that)
::glEnable(GL_LINE_SMOOTH);
::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
// draw surface mesh
bool m_view_surface = true;
bool draw_triangles_edges = true;
if(m_view_surface)
{
::glEnable(GL_LIGHTING);
::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
::glColor3f(0.2f, 0.2f, 1.f);
::glEnable(GL_POLYGON_OFFSET_FILL);
::glPolygonOffset(3.0f,-3.0f);
gl_draw_surface();
if(draw_triangles_edges)
{
::glDisable(GL_LIGHTING);
::glLineWidth(1.);
::glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
::glColor3ub(0,0,0);
::glDisable(GL_POLYGON_OFFSET_FILL);
gl_draw_surface();
}
}
if(!are_buffers_initialized)
initialize_buffers();
QColor color;
//points
vao[1].bind();
attrib_buffers(this);
rendering_program_points.bind();
color.setRgbF(1.0f, 0.0f, 0.0f);
glPointSize(5);
::glEnable(GL_POINT_SMOOTH);
rendering_program_points.setUniformValue(colorLocation_points, color);
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(pos_points.size()/3));
rendering_program_points.release();
vao[1].release();
//facets
vao[0].bind();
attrib_buffers(this);
rendering_program.bind();
color.setRgbF(0.5f, 1.0f, 0.5f);
rendering_program.setUniformValue(colorLocation, color);
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_poly.size()/3));
rendering_program.release();
vao[0].release();
}
void
Viewer::gl_draw_surface()
void Viewer::alphaChanged()
{
::glColor3f(1.0f, 0.0f, 0.0f);
::glDisable(GL_LIGHTING);
::glEnable(GL_POINT_SMOOTH);
::glPointSize(5);
::glBegin(GL_POINTS);
for(std::list<Point_3>::iterator it = scene->points.begin();
it != scene->points.end();
++it){
::glVertex3d(it->x(), it->y(), it->z());
}
::glEnd();
::glDisable(GL_POINT_SMOOTH);
::glEnable(GL_LIGHTING);
::glBegin(GL_TRIANGLES);
normals.resize(0);
pos_poly.resize(0);
::glColor3f(0.2f, 1.0f, 0.2f);
std::list<Facet> facets;
scene->alpha_shape.get_alpha_shape_facets(std::back_inserter(facets), Alpha_shape_3::REGULAR);
std::list<Facet> facets;
scene->alpha_shape.get_alpha_shape_facets(std::back_inserter(facets), Alpha_shape_3::REGULAR);
for(std::list<Facet>::iterator fit = facets.begin();
fit != facets.end();
++fit) {
const Cell_handle& ch = fit->first;
const int index = fit->second;
//const Vector_3& n = ch->normal(index); // must be unit vector
const Point_3& a = ch->vertex((index+1)&3)->point();
const Point_3& b = ch->vertex((index+2)&3)->point();
const Point_3& c = ch->vertex((index+3)&3)->point();
Vector_3 v = CGAL::unit_normal(a,b,c);
for(std::list<Facet>::iterator fit = facets.begin();
fit != facets.end();
++fit) {
const Cell_handle& ch = fit->first;
const int index = fit->second;
//const Vector_3& n = ch->normal(index); // must be unit vector
::glNormal3d(v.x(),v.y(),v.z());
::glVertex3d(a.x(),a.y(),a.z());
::glVertex3d(b.x(),b.y(),b.z());
::glVertex3d(c.x(),c.y(),c.z());
}
const Point_3& a = ch->vertex((index+1)&3)->point();
const Point_3& b = ch->vertex((index+2)&3)->point();
const Point_3& c = ch->vertex((index+3)&3)->point();
::glEnd();
Vector_3 v = CGAL::unit_normal(a,b,c);
normals.push_back(v.x()); normals.push_back(v.y()); normals.push_back(v.z());
normals.push_back(v.x()); normals.push_back(v.y()); normals.push_back(v.z());
normals.push_back(v.x()); normals.push_back(v.y()); normals.push_back(v.z());
pos_poly.push_back(a.x()); pos_poly.push_back(a.y()); pos_poly.push_back(a.z());
pos_poly.push_back(b.x()); pos_poly.push_back(b.y()); pos_poly.push_back(b.z());
pos_poly.push_back(c.x()); pos_poly.push_back(c.y()); pos_poly.push_back(c.z());
}
initialize_buffers();
}
#include "Viewer.moc"

View File

@ -3,9 +3,13 @@
#include "typedefs.h"
#include <QGLViewer/qglviewer.h>
#include <QOpenGLFunctions_3_3_Core>
#include <QOpenGLVertexArrayObject>
#include <QOpenGLBuffer>
#include <QOpenGLShaderProgram>
class Viewer : public QGLViewer {
class Viewer : public QGLViewer, protected QOpenGLFunctions_3_3_Core{
Q_OBJECT
CGAL::Timer timer;
@ -13,10 +17,15 @@ class Viewer : public QGLViewer {
int nr_of_facets;
public:
Viewer(QWidget* parent)
: QGLViewer(parent)
{}
Viewer(QWidget* parent);
~Viewer()
{
buffers[0].destroy();
buffers[1].destroy();
buffers[2].destroy();
vao[0].destroy();
vao[1].destroy();
}
void setScene(Scene* scene_)
{
scene = scene_;
@ -27,13 +36,41 @@ public:
public:
void draw();
void
gl_draw_surface();
private:
bool are_buffers_initialized;
//Shaders elements
int poly_vertexLocation;
int points_vertexLocation;
int normalsLocation;
int mvpLocation;
int mvpLocation_points;
int mvLocation;
int colorLocation;
int colorLocation_points;
int lightLocation[5];
std::vector<float> pos_points;
std::vector<float> pos_poly;
std::vector<float> normals;
QOpenGLBuffer buffers[3];
QOpenGLVertexArrayObject vao[2];
QOpenGLShaderProgram rendering_program;
QOpenGLShaderProgram rendering_program_points;
void initialize_buffers();
void compute_elements();
void attrib_buffers(QGLViewer*);
void compile_shaders();
public Q_SLOTS:
void initializeGL();
void sceneChanged();
void changed(){
compute_elements();
are_buffers_initialized = false;
}
void alphaChanged();
void sceneChanged();
};
#endif

View File

@ -9,7 +9,7 @@ include( ${CGAL_USE_FILE} )
find_package(Qt3-patched)
# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so
# that it can be used together with FindQt4: all its variables are prefixed
# that it can be used together with Qt5: all its variables are prefixed
# by "QT3_" instead of "QT_".
if ( CGAL_FOUND AND QT3_FOUND AND CGAL_Qt3_FOUND )

View File

@ -4,12 +4,8 @@
project( Arithmetic_kernel_test )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()
cmake_minimum_required(VERSION 2.8.11)
find_package(CGAL QUIET COMPONENTS Core GMP MPFR MPFI)

View File

@ -51,6 +51,7 @@ QVariant ArrangementDemoPropertiesDialog::property( int index )
// return user data, if it is set
QVariant myData = item->data( Qt::UserRole );
/*
if ( qVariantCanConvert< QColor >( myData ) ||
qVariantCanConvert< DeleteCurveMode >( myData ) )
{
@ -60,7 +61,17 @@ QVariant ArrangementDemoPropertiesDialog::property( int index )
{
res = item->data( Qt::DisplayRole );
}
*/
if ( myData.canConvert<QColor>() ||
myData.canConvert<DeleteCurveMode>())
{
return myData;
}
else
{
res = item->data( Qt::DisplayRole );
}
return res;
}

View File

@ -693,7 +693,7 @@ void ArrangementDemoWindow::updateConicType( QAction* newType )
curveInputCallback->setCurveType( LinearCurveInputCallback::SEGMENT );
}
else if ( newType == this->ui->actionCurveRay )
{
{
curveInputCallback->setCurveType( LinearCurveInputCallback::RAY );
}
else if ( newType == this->ui->actionCurveLine )
@ -1183,38 +1183,34 @@ void ArrangementDemoWindow::on_actionPreferences_triggered( )
if ( dialog->exec( ) == QDialog::Accepted )
{
typedef ArrangementDemoPropertiesDialog Dialog;
QColor edgeColor =
qVariantValue<QColor>(dialog->property(Dialog::EDGE_COLOR_KEY));
unsigned int edgeWidth =
qVariantValue<unsigned int>(dialog->property(Dialog::EDGE_WIDTH_KEY));
QColor vertexColor =
qVariantValue<QColor>(dialog->property(Dialog::VERTEX_COLOR_KEY));
unsigned int vertexRadius =
qVariantValue<unsigned int>(dialog->property(Dialog::VERTEX_RADIUS_KEY));
QColor envelopeEdgeColor =
qVariantValue<QColor>(dialog->property(Dialog::ENVELOPE_EDGE_COLOR_KEY));
unsigned int envelopeEdgeWidth =
qVariantValue<unsigned int>(dialog->property(Dialog::
ENVELOPE_EDGE_WIDTH_KEY));
QColor envelopeVertexColor =
qVariantValue<QColor>(dialog->property(Dialog::
ENVELOPE_VERTEX_COLOR_KEY));
unsigned int envelopeVertexRadius =
qVariantValue<unsigned int>(dialog->property(Dialog::
ENVELOPE_VERTEX_RADIUS_KEY));
QColor verticalRayEdgeColor =
qVariantValue<QColor>(dialog->property(Dialog::
VERTICAL_RAY_EDGE_COLOR_KEY));
unsigned int verticalRayEdgeWidth =
qVariantValue<unsigned int>(dialog->property
(Dialog::VERTICAL_RAY_EDGE_WIDTH_KEY));
DeleteCurveMode mode =
qVariantValue<DeleteCurveMode>(dialog->property(Dialog::
DELETE_CURVE_MODE_KEY));
unsigned int gridSize =
qVariantValue<unsigned int>(dialog->property(Dialog::GRID_SIZE_KEY));
QColor gridColor =
qVariantValue<QColor>(dialog->property(Dialog::GRID_COLOR_KEY));
QColor edgeColor = dialog->property(Dialog::EDGE_COLOR_KEY).value<QColor>();
unsigned int edgeWidth = dialog->property(Dialog::EDGE_WIDTH_KEY).value<unsigned int>();
QColor vertexColor = dialog->property(Dialog::VERTEX_COLOR_KEY).value<QColor>();
unsigned int vertexRadius = dialog->property(Dialog::VERTEX_RADIUS_KEY).value<unsigned int>();
QColor envelopeEdgeColor = dialog->property(Dialog::ENVELOPE_EDGE_COLOR_KEY).value<QColor>();
unsigned int envelopeEdgeWidth = dialog->property(Dialog::ENVELOPE_EDGE_WIDTH_KEY).value<unsigned int>();
QColor envelopeVertexColor = dialog->property(Dialog::ENVELOPE_VERTEX_COLOR_KEY).value<QColor>();
unsigned int envelopeVertexRadius = dialog->property(Dialog::ENVELOPE_VERTEX_RADIUS_KEY).value<unsigned int>();
QColor verticalRayEdgeColor = dialog->property(Dialog::VERTICAL_RAY_EDGE_COLOR_KEY).value<QColor>();
unsigned int verticalRayEdgeWidth = dialog->property(Dialog::VERTICAL_RAY_EDGE_WIDTH_KEY).value<unsigned int>();
DeleteCurveMode mode = dialog->property(Dialog::DELETE_CURVE_MODE_KEY).value<DeleteCurveMode>();
unsigned int gridSize = dialog->property(Dialog::GRID_SIZE_KEY).value<unsigned int>();
QColor gridColor = dialog->property(Dialog::GRID_COLOR_KEY).value<QColor>();
//end new for Qt5 version !
QPen edgesPen(QBrush(edgeColor), edgeWidth);
QPen verticesPen(QBrush(vertexColor), vertexRadius);

View File

@ -2,31 +2,28 @@
project( Arrangement_2 )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Core Qt4 )
find_package(CGAL COMPONENTS Core Qt5 )
include( ${CGAL_USE_FILE} )
find_package( Qt4 )
find_package( Qt5 QUIET COMPONENTS Script Widgets )
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND)
include( ${QT_USE_FILE} )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND)
include_directories( ./ )
# Arrangement package includes
include_directories( BEFORE ../../include )
qt4_wrap_ui( arrangement_2_uis
qt5_wrap_ui( arrangement_2_uis
ArrangementDemoWindow.ui
NewTabDialog.ui
OverlayDialog.ui
ArrangementDemoPropertiesDialog.ui
)
qt4_wrap_cpp( arrangement_2_mocs
qt5_wrap_cpp( arrangement_2_mocs
ArrangementDemoWindow.h
ArrangementDemoTab.h
Callback.h
@ -38,7 +35,7 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND)
PropertyValueDelegate.h
#PropertyValueDelegate.cpp
)
qt4_add_resources( arrangement_2_resources
qt5_add_resources( arrangement_2_resources
ArrangementDemoWindow.qrc
)
add_executable( arrangement_2
@ -68,16 +65,18 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND)
${arrangement_2_uis}
${arrangement_2_resources}
)
qt5_use_modules(arrangement_2 Widgets Script)
target_link_libraries( arrangement_2
${CGAL_LIBRARIES}
${CGAL_3RD_PARTY_LIBRARIES}
${QT_LIBRARIES}
)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS arrangement_2 )
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
endif()

View File

@ -41,6 +41,8 @@
#include <QtGui>
#include <iostream>
#include <QColorDialog>
#include "ColorItemEditor.h"

View File

@ -33,8 +33,7 @@ DeleteCurveModeItemEditor::DeleteCurveModeItemEditor( QWidget* parent ) :
DeleteCurveMode DeleteCurveModeItemEditor::mode( ) const
{
return qVariantValue<DeleteCurveMode >(this->itemData(this->currentIndex( ),
Qt::UserRole ) );
return this->itemData(this->currentIndex( ), Qt::UserRole ).value< DeleteCurveMode >();
}
void DeleteCurveModeItemEditor::setMode( DeleteCurveMode m )

View File

@ -23,6 +23,8 @@
#include "DeleteCurveMode.h"
#include <iostream>
#include <QItemEditorFactory>
PropertyValueDelegate::PropertyValueDelegate( QObject* parent ):
QItemDelegate( parent )
@ -42,6 +44,7 @@ createEditor( QWidget* parent, const QStyleOptionViewItem& option,
QVariant myData = index.data( Qt::UserRole );
// check for data types we need to handle ourselves
/*
if ( qVariantCanConvert< QColor >( myData ) )
{
ColorItemEditor* colorEditor = new ColorItemEditor( parent );
@ -60,6 +63,28 @@ createEditor( QWidget* parent, const QStyleOptionViewItem& option,
SLOT( commit( ) ) );
}
else
{ // default handler
editor = QItemDelegate::createEditor( parent, option, index );
}*/
if ( myData.canConvert< QColor >() )
{
ColorItemEditor* colorEditor = new ColorItemEditor( parent );
editor = colorEditor;
QObject::connect( colorEditor, SIGNAL(confirmed()), this, SLOT(commit()));
}
else if ( myData.canConvert< DeleteCurveMode >() )
{
DeleteCurveModeItemEditor* modeEditor =
new DeleteCurveModeItemEditor( parent );
modeEditor->setMode( myData.value< DeleteCurveMode >() );
editor = modeEditor;
QObject::connect( modeEditor, SIGNAL( currentIndexChanged( int ) ), this,
SLOT( commit( ) ) );
}
else
{ // default handler
editor = QItemDelegate::createEditor( parent, option, index );
}

View File

@ -21,6 +21,9 @@
#define PROPERTY_VALUE_DELEGATE_H
#include <QtGui>
#include <QItemDelegate>
#include <QSpinBox>
class PropertyValueDelegate : public QItemDelegate
{

View File

@ -2,13 +2,9 @@
project( Arrangement_2 )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Core Qt3 )
@ -17,7 +13,7 @@ include( ${CGAL_USE_FILE} )
find_package(Qt3-patched)
# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so
# that it can be used together with FindQt4: all its variables are prefixed
# that it can be used together with Qt5: all its variables are prefixed
# by "QT3_" instead of "QT_".
if ( CGAL_FOUND AND CGAL_Qt3_FOUND AND QT3_FOUND )

View File

@ -4,14 +4,8 @@
project( BGL )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()
endif()
cmake_minimum_required(VERSION 2.8.11)
set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true )
@ -36,7 +30,7 @@ include( ${CGAL_USE_FILE} )
# Boost and its components
find_package( Boost REQUIRED )
find_package( Boost )
if ( NOT Boost_FOUND )
message(STATUS "This project requires the Boost library, and will not be compiled.")

View File

@ -2,11 +2,9 @@
project( Boolean_operations_2 )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt3 )
@ -14,7 +12,7 @@ include( ${CGAL_USE_FILE} )
find_package(Qt3-patched)
# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so
# that it can be used together with FindQt4: all its variables are prefixed
# that it can be used together with Qt5: all its variables are prefixed
# by "QT3_" instead of "QT_".
if ( CGAL_FOUND AND CGAL_Qt3_FOUND AND QT3_FOUND )

View File

@ -3,41 +3,37 @@
project( Boolean_operations_2_demo )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4 Core )
find_package(CGAL COMPONENTS Qt5 Core )
include(${CGAL_USE_FILE})
set( QT_USE_QTMAIN TRUE )
find_package(Qt4)
find_package(Qt5 QUIET COMPONENTS Widgets Script)
include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../include )
include_directories (BEFORE ${CMAKE_CURRENT_BINARY_DIR})
include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include )
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND AND CGAL_Core_FOUND )
include(${QT_USE_FILE})
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND CGAL_Core_FOUND )
# UI files (Qt Designer files)
qt4_wrap_ui( CDT_UI_FILES boolean_operations_2.ui )
qt5_wrap_ui( CDT_UI_FILES boolean_operations_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( CDT_RESOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/boolean_operations_2.qrc )
qt5_add_resources ( CDT_RESOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/boolean_operations_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( "boolean_operations_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/boolean_operations_2.moc" )
qt5_generate_moc( "boolean_operations_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/boolean_operations_2.moc" )
# The executable itself.
add_executable ( boolean_operations_2 ${CMAKE_CURRENT_SOURCE_DIR}/boolean_operations_2.cpp boolean_operations_2.moc ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} )
qt5_use_modules(boolean_operations_2 Widgets Script)
# Link with Qt libraries
target_link_libraries( boolean_operations_2 ${QT_LIBRARIES} )
@ -46,6 +42,6 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND AND CGAL_Core_FOUND )
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
endif()

View File

@ -51,6 +51,7 @@ void trace( std::string s )
#include <QDropEvent>
#include <QSlider>
#include <QProgressBar>
#include <QMessageBox>
#include <CGAL/basic.h>
#include <CGAL/Cartesian_converter.h>
@ -81,6 +82,7 @@ void trace( std::string s )
#include <CGAL/Quotient.h>
#endif
#include <CGAL/Qt/BezierCurves.h>
#include <CGAL/Qt/CircularPolygons.h>
#include <CGAL/Qt/GraphicsViewBezierPolygonInput.h>
@ -1629,9 +1631,8 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Boolean_operations_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGALQt5.
CGAL_QT_INIT_RESOURCES;
MainWindow mainWindow;
mainWindow.show();

View File

@ -22,11 +22,13 @@
#ifndef CGAL_QT_GRAPHICS_VIEW_BEZIER_POLYGON_INPUT_H
#define CGAL_QT_GRAPHICS_VIEW_BEZIER_POLYGON_INPUT_H
#include <CGAL/auto_link/Qt4.h>
#include <CGAL/auto_link/Qt.h>
#include <QPolygonF>
#include <QPointF>
#include <QGraphicsLineItem>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include <CGAL/Qt/GraphicsViewInput.h>
#include <CGAL/Qt/Converter.h>
@ -132,7 +134,7 @@ namespace Qt {
bool rHandled = false ;
Point lP = cvt(aEvent->scenePos());
if ( aEvent->button() == ::Qt::LeftButton )
{
switch (mState)

View File

@ -22,11 +22,13 @@
#ifndef CGAL_QT_GRAPHICS_VIEW_CIRCULAR_POLYGON_INPUT_H
#define CGAL_QT_GRAPHICS_VIEW_CIRCULAR_POLYGON_INPUT_H
#include <CGAL/auto_link/Qt4.h>
#include <CGAL/auto_link/Qt.h>
#include <QPolygonF>
#include <QPointF>
#include <QGraphicsLineItem>
#include <QGraphicsScene>
#include <CGAL/Qt/GraphicsViewInput.h>
#include <CGAL/Qt/Converter.h>

View File

@ -80,19 +80,19 @@ protected:
template <class R, class D, class P>
void Piecewise_region_graphics_item<R,D,P>::update_region_bbox( Piecewise_region const& aRegion, Piecewise_graphics_item_base::Bbox_builder& aBboxBuilder )
{
update_boundary_bbox( aRegion.outer_boundary(), aBboxBuilder ) ;
this->update_boundary_bbox( aRegion.outer_boundary(), aBboxBuilder ) ;//"This" added for qt5 version !
for( Hole_const_itertator hit = aRegion.holes_begin(); hit != aRegion.holes_end(); ++ hit )
update_boundary_bbox(*hit,aBboxBuilder);
this->update_boundary_bbox(*hit,aBboxBuilder);//"This" added for qt5 version !
}
template <class R, class D, class P>
void Piecewise_region_graphics_item<R,D,P>::draw_region( Piecewise_region const& aRegion, QPainterPath& aPath )
{
draw_boundary( aRegion.outer_boundary(), aPath ) ;
this->draw_boundary( aRegion.outer_boundary(), aPath ) ;//This added for qt5 version !
for( Hole_const_itertator hit = aRegion.holes_begin(); hit != aRegion.holes_end(); ++ hit )
draw_boundary(*hit,aPath);
this->draw_boundary(*hit,aPath);//"This" added for qt5 version !
}

View File

@ -103,7 +103,7 @@ void Piecewise_set_graphics_item<S,D,P>::update_set_bbox( Piecewise_set const& a
aSet.polygons_with_holes( std::back_inserter(vec) ) ;
for( Region_const_iterator rit = vec.begin(); rit != vec.end() ; ++ rit )
update_region_bbox(*rit,aBboxBuilder);
this->update_region_bbox(*rit,aBboxBuilder);//This added for Qt5 version !
}
template <class S, class D, class P>
@ -114,7 +114,7 @@ void Piecewise_set_graphics_item<S,D,P>::draw_set( Piecewise_set const& aSet, QP
aSet.polygons_with_holes( std::back_inserter(vec) ) ;
for( Region_const_iterator rit = vec.begin(); rit != vec.end() ; ++ rit )
draw_region(*rit,aPath);
this->draw_region(*rit,aPath);//This added for Qt5 version !
}
} // namespace Qt

View File

@ -2,11 +2,9 @@
project( Min_circle_2_Demo )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt3 )
@ -14,7 +12,7 @@ include( ${CGAL_USE_FILE} )
find_package(Qt3-patched)
# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so
# that it can be used together with FindQt4: all its variables are prefixed
# that it can be used together with Qt5: all its variables are prefixed
# by "QT3_" instead of "QT_".
if ( CGAL_FOUND AND CGAL_Qt3_FOUND AND QT3_FOUND )

View File

@ -2,11 +2,9 @@
project( Min_ellipse_2_Demo )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt3 )
@ -14,7 +12,7 @@ include( ${CGAL_USE_FILE} )
find_package(Qt3-patched)
# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so
# that it can be used together with FindQt4: all its variables are prefixed
# that it can be used together with Qt5: all its variables are prefixed
# by "QT3_" instead of "QT_".
if ( CGAL_FOUND AND CGAL_Qt3_FOUND AND QT3_FOUND )

View File

@ -2,11 +2,9 @@
project( min_quadrilateral_2 )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt3 )
@ -14,7 +12,7 @@ include( ${CGAL_USE_FILE} )
find_package(Qt3-patched)
# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so
# that it can be used together with FindQt4: all its variables are prefixed
# that it can be used together with Qt5: all its variables are prefixed
# by "QT3_" instead of "QT_".
if ( CGAL_FOUND AND CGAL_Qt3_FOUND AND QT3_FOUND )

View File

@ -1,14 +1,8 @@
project( Core_examples )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()
endif()
cmake_minimum_required(VERSION 2.8.11)
set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true )
@ -33,7 +27,7 @@ include( ${CGAL_USE_FILE} )
# Boost and its components
find_package( Boost REQUIRED )
find_package( Boost )
if ( NOT Boost_FOUND )

View File

@ -10,7 +10,9 @@ link_directories ( ${CGAL_LIBRARIES_DIR} ${CGAL_3RD_PARTY_LIBRARIES_DIRS} )
collect_cgal_library(CGAL_Core "")
target_link_libraries( CGAL_Core ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} )
# CGAL_Core does not depend on CGAL in either DEBUG or RELEASE, but we
# still link it.
target_link_libraries( CGAL_Core CGAL ${CGAL_3RD_PARTY_LIBRARIES} )
add_dependencies( CGAL_Core CGAL )

View File

@ -1,6 +1,27 @@
project(image_to_vtk_viewer)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
set(PACKAGE_ROOT ../..)
# Add several CGAL packages to the include and link paths,
# if they lie in ${PACKAGE_ROOT}/.
foreach(INC_DIR ${PACKAGE_ROOT}/include
${PACKAGE_ROOT}/../CGAL_ImageIO/include )
if(EXISTS ${INC_DIR})
include_directories (BEFORE ${INC_DIR})
endif()
endforeach()
foreach(LIB_DIR ${PACKAGE_ROOT}/../CGAL_ImageIO/src/CGAL_ImageIO)
if (EXISTS ${LIB_DIR})
link_directories (${LIB_DIR})
endif()
endforeach()
find_package(CGAL REQUIRED ImageIO)
include( ${CGAL_USE_FILE} )

View File

@ -52,10 +52,6 @@ int main(int argc, char** argv)
QVTKWidget widget;
widget.resize(256,256);
#if QT_VERSION < 0x040000
app.setMainWidget(&widget);
#endif
CGAL::Image_3 image;
if(!image.read(argv[1]))
{

View File

@ -3,12 +3,8 @@
project( CGALImageIO_example )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()
cmake_minimum_required(VERSION 2.8.11)
find_package(CGAL QUIET COMPONENTS ImageIO )

View File

@ -57,7 +57,9 @@ if(OPENGL_FOUND)
add_definitions( ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_ImageIO_3RD_PARTY_DEFINITIONS} )
target_link_libraries( CGAL_ImageIO ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_ImageIO_3RD_PARTY_LIBRARIES} )
# CGAL_ImageIO only depends on CGAL in DEBUG, but we still link it
# in both build types.
target_link_libraries( CGAL_ImageIO CGAL ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_ImageIO_3RD_PARTY_LIBRARIES} )
message("libCGAL_ImageIO is configured")

View File

@ -4,12 +4,8 @@
project( CGALImageIO_test )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()
cmake_minimum_required(VERSION 2.8.11)
include_directories(../../include)

View File

@ -1,8 +1,6 @@
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
macro( remove_leading_zero var )

View File

@ -180,6 +180,6 @@ fi
#
if [ -n "${NEED_CLEAN}" ]; then
if ! ( uname | grep -q "CYGWIN" ) ; then
${MAKE_CMD} -fMakefile clean
${MAKE_CMD} -fMakefile clean || true
fi
fi

View File

@ -3,11 +3,7 @@ message( "== CMake setup ==" )
project(CGAL CXX C)
# Minimal version of CMake:
if(WIN32)
cmake_minimum_required(VERSION 2.8.6)
else()
cmake_minimum_required(VERSION 2.6.2)
endif()
cmake_minimum_required(VERSION 2.8.11)
# option for branch build

View File

@ -1,33 +1,28 @@
project (Circular_kernel_3)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4)
find_package(CGAL COMPONENTS Qt5)
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)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
find_package(OpenGL)
find_package(QGLViewer)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
include(${QT_USE_FILE})
include_directories (${QGLVIEWER_INCLUDE_DIR})
include_directories (BEFORE ../../include ./ )
add_executable ( Circular_kernel_3 Circular_kernel_3.cpp Viewer.cpp )
qt5_use_modules( Circular_kernel_3 Xml Script OpenGL)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Circular_kernel_3 )
target_link_libraries( Circular_kernel_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
@ -36,6 +31,6 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_
else()
message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, OpenGL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, OpenGL and Qt5, and will not be compiled.")
endif()

View File

@ -8,13 +8,9 @@ int main(int argc, char** argv)
// Instantiate the viewer.
Viewer viewer;
#if QT_VERSION < 0x040000
// Set the viewer as the application main widget.
application.setMainWidget(&viewer);
#else
//for Windows
application.setAttribute(Qt::AA_UseDesktopOpenGL);
viewer.setWindowTitle("Intersection points of randomly generated circles.");
#endif
// Make the viewer window visible on screen.
viewer.show();

View File

@ -3,153 +3,789 @@
#include <CGAL/squared_distance_3.h>
#include <CGAL/Exact_spherical_kernel_3.h>
#include <vector>
#include <CGAL/Qt/CreateOpenGLContext.h>
Viewer::Viewer(QWidget* parent )
: QGLViewer(CGAL::Qt::createOpenGLContext(),parent)
{
}
void Viewer::compile_shaders()
{
initializeOpenGLFunctions();
if(! buffers[0].create() || !buffers[1].create() || !buffers[2].create() || !buffers[3].create()
|| !buffers[4].create() || !buffers[4].create() || !buffers[5].create() || !buffers[6].create()
|| !buffers[7].create() || !buffers[8].create())
{
std::cerr<<"VBO Creation FAILED"<<std::endl;
}
if(!vao[0].create() || !vao[1].create() || !vao[2].create())
{
std::cerr<<"VAO Creation FAILED"<<std::endl;
}
//The sphere
//Vertex source code
const char vertex_source[] =
{
"#version 330 \n"
"in highp vec4 vertex;\n"
"in highp vec3 normal;\n"
"in highp vec4 center;\n"
"uniform highp mat4 mvp_matrix;\n"
"uniform highp mat4 mv_matrix; \n"
"out highp vec4 fP; \n"
"out highp vec3 fN; \n"
"void main(void)\n"
"{\n"
" fP = mv_matrix * vertex; \n"
" fN = mat3(mv_matrix)* normal; \n"
" gl_Position = mvp_matrix * (vertex+vec4(center.xyz, 0.0));\n"
"}"
};
//Vertex source code
const char fragment_source[] =
{
"#version 330 \n"
"in highp vec4 fP; \n"
"in highp vec3 fN; \n"
"uniform highp vec4 color; \n"
"uniform vec4 light_pos; \n"
"uniform vec4 light_diff; \n"
"uniform vec4 light_spec; \n"
"uniform vec4 light_amb; \n"
"uniform float spec_power ; \n"
"void main(void) { \n"
" vec3 L = light_pos.xyz - fP.xyz; \n"
" vec3 V = -fP.xyz; \n"
" vec3 N = normalize(fN); \n"
" L = normalize(L); \n"
" V = normalize(V); \n"
" vec3 R = reflect(-L, N); \n"
" vec4 diffuse = max(dot(N,L), 0.0) * light_diff * color; \n"
" vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n"
"gl_FragColor = light_amb*color + diffuse ; \n"
"} \n"
"\n"
};
QOpenGLShader *vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
if(!vertex_shader->compileSourceCode(vertex_source))
{
std::cerr<<"Compiling vertex source FAILED"<<std::endl;
}
QOpenGLShader *fragment_shader= new QOpenGLShader(QOpenGLShader::Fragment);
if(!fragment_shader->compileSourceCode(fragment_source))
{
std::cerr<<"Compiling fragmentsource FAILED"<<std::endl;
}
if(!rendering_program.addShader(vertex_shader))
{
std::cerr<<"adding vertex shader FAILED"<<std::endl;
}
if(!rendering_program.addShader(fragment_shader))
{
std::cerr<<"adding fragment shader FAILED"<<std::endl;
}
if(!rendering_program.link())
{
std::cerr<<"linking Program FAILED"<<std::endl;
}
rendering_program.bind();
}
void Viewer::initialize_buffers()
{
//The big white sphere
vao[0].bind();
//points of the sphere
buffers[0].bind();
buffers[0].allocate(pos_sphere.data(),
static_cast<int>(pos_sphere.size()*sizeof(float)));
vertexLocation[0] = rendering_program.attributeLocation("vertex");
rendering_program.bind();
rendering_program.enableAttributeArray(vertexLocation[0]);
rendering_program.setAttributeBuffer(vertexLocation[0],GL_FLOAT,0,3);
buffers[0].release();
//normals of the sphere
buffers[1].bind();
buffers[1].allocate(normals.data(),
static_cast<int>(normals.size()*sizeof(float)));
normalsLocation[0] = rendering_program.attributeLocation("normal");
rendering_program.bind();
rendering_program.enableAttributeArray(normalsLocation[0]);
rendering_program.setAttributeBuffer(normalsLocation[0],GL_FLOAT,0,3);
buffers[1].release();
//center of the sphere
buffers[2].bind();
buffers[2].allocate(trivial_center.data(),
static_cast<int>(trivial_center.size()*sizeof(float)));
trivialCenterLocation = rendering_program.attributeLocation("center");
rendering_program.bind();
rendering_program.enableAttributeArray(trivialCenterLocation);
rendering_program.setAttributeBuffer(trivialCenterLocation,GL_FLOAT,0,3);
buffers[2].release();
glVertexAttribDivisor(trivialCenterLocation, 1);
glVertexAttribDivisor(normalsLocation[0], 0);
vao[0].release();
//The circles
vao[1].bind();
buffers[3].bind();
buffers[3].allocate(pos_lines.data(),
static_cast<int>(pos_lines.size()*sizeof(float)));
vertexLocation[2] = rendering_program.attributeLocation("vertex");
rendering_program.bind();
rendering_program.enableAttributeArray(vertexLocation[2]);
rendering_program.setAttributeBuffer(vertexLocation[2],GL_FLOAT,0,3);
buffers[3].release();
//normals
buffers[4].bind();
buffers[4].allocate(normals_lines.data(),
static_cast<int>(normals_lines.size()*sizeof(float)));
normalsLocation[1] = rendering_program.attributeLocation("normal");
rendering_program.bind();
rendering_program.enableAttributeArray(normalsLocation[1]);
rendering_program.setAttributeBuffer(normalsLocation[1],GL_FLOAT,0,3);
buffers[4].release();
//center
buffers[5].bind();
buffers[5].allocate(trivial_center.data(),
static_cast<int>(trivial_center.size()*sizeof(float)));
trivialCenterLocation = rendering_program.attributeLocation("center");
rendering_program.bind();
rendering_program.enableAttributeArray(trivialCenterLocation);
rendering_program.setAttributeBuffer(trivialCenterLocation,GL_FLOAT,0,3);
buffers[5].release();
glVertexAttribDivisor(trivialCenterLocation, 1);
glVertexAttribDivisor(normalsLocation[0], 0);
rendering_program.release();
vao[1].release();
//The little green spheres
vao[2].bind();
//points of the sphere
buffers[6].bind();
buffers[6].allocate(pos_sphere_inter.data(),
static_cast<int>(pos_sphere_inter.size()*sizeof(float)));
vertexLocation[2] = rendering_program.attributeLocation("vertex");
rendering_program.bind();
rendering_program.enableAttributeArray(vertexLocation[2]);
rendering_program.setAttributeBuffer(vertexLocation[2],GL_FLOAT,0,3);
buffers[6].release();
//normals of the sphere
buffers[7].bind();
buffers[7].allocate(normals_inter.data(),
static_cast<int>(normals_inter.size()*sizeof(float)));
normalsLocation[2] = rendering_program.attributeLocation("normal");
rendering_program.bind();
rendering_program.enableAttributeArray(normalsLocation[2]);
rendering_program.setAttributeBuffer(normalsLocation[2],GL_FLOAT,0,3);
buffers[7].release();
//center of the sphere
buffers[8].bind();
buffers[8].allocate(pos_points.data(),
static_cast<int>(pos_points.size()*sizeof(float)));
centerLocation = rendering_program.attributeLocation("center");
rendering_program.bind();
rendering_program.enableAttributeArray(centerLocation);
rendering_program.setAttributeBuffer(centerLocation,GL_FLOAT,0,3);
buffers[8].release();
glVertexAttribDivisor(centerLocation, 1);
glVertexAttribDivisor(normalsLocation[1], 0);
vao[2].release();
template <class Kernel>
void Viewer::draw_circle_on_unit_sphere(const typename CGAL::Point_3<Kernel>& center) const {
const typename Kernel::Point_3 origin(0,0,0);
const typename Kernel::Plane_3 plane(center, center-origin);
typename Kernel::Vector_3 base1=plane.base1();
typename Kernel::Vector_3 base2=plane.base2();
base1=base1/CGAL::sqrt(base1.squared_length());
base2=base2/CGAL::sqrt(base2.squared_length());
const double radius=CGAL::sqrt( CGAL::to_double( 1 - CGAL::squared_distance(origin,center) ) );
const double nb_pt_per_circle=100;
const double step=2 * CGAL_PI / nb_pt_per_circle;
::glDisable(GL_LIGHTING);
::glBegin(GL_LINE_LOOP);
for (double theta = 0; theta < 2 * CGAL_PI ; theta += step) {
const typename Kernel::Point_3 point=center + ( radius*cos(theta)*base1 + radius*sin(theta)*base2 );
::glVertex3f( point.x(),point.y(),point.z() );
}
::glEnd();
::glEnable(GL_LIGHTING);
}
void Viewer::compute_elements()
{
//The Central Sphere
{
pos_sphere.resize(0);
trivial_center.resize(0);
int rings=3,sectors=6;
float T, P, R = 0.999f;
float x[4],y[4],z[4];
//Top of the sphere
for(int t=0; t<360; t+=sectors)
{
pos_sphere.push_back(0);
pos_sphere.push_back(0);
pos_sphere.push_back(R);
normals.push_back(0);
normals.push_back(0);
normals.push_back(1);
P = rings*M_PI/180.0;
T = t*M_PI/180.0;
x[1] = sin(P) * cos(T) ;
y[1] = sin(P) * sin(T) ;
z[1] = cos(P);
pos_sphere.push_back(R * x[1]);
pos_sphere.push_back(R * y[1]);
pos_sphere.push_back(R * z[1]);
normals.push_back(x[1]);
normals.push_back(y[1]);
normals.push_back(z[1]);
//
P = rings*M_PI/180.0;
T = (t+sectors)*M_PI/180.0;
x[2] = sin(P) * cos(T) ;
y[2] = sin(P) * sin(T) ;
z[2] = cos(P);
pos_sphere.push_back(R * x[2]);
pos_sphere.push_back(R * y[2]);
pos_sphere.push_back(R * z[2]);
normals.push_back(x[2]);
normals.push_back(y[2]);
normals.push_back(z[2]);
}
//Body of the sphere
for (int p=rings; p<180-rings; p+=rings)
for(int t=0; t<360; t+=sectors)
{
//A
P = p*M_PI/180.0;
T = t*M_PI/180.0;
x[0] = sin(P) * cos(T) ;
y[0] = sin(P) * sin(T) ;
z[0] = cos(P);
pos_sphere.push_back(R * x[0]);
pos_sphere.push_back(R * y[0]);
pos_sphere.push_back(R * z[0]);
normals.push_back(x[0]);
normals.push_back(y[0]);
normals.push_back(z[0]);
//B
P = (p+rings)*M_PI/180.0;
T = t*M_PI/180.0;
x[1] = sin(P) * cos(T) ;
y[1] = sin(P) * sin(T) ;
z[1] = cos(P);
pos_sphere.push_back(R * x[1]);
pos_sphere.push_back(R * y[1]);
pos_sphere.push_back(R * z[1]);
normals.push_back(x[1]);
normals.push_back(y[1]);
normals.push_back(z[1]);
//C
P = p*M_PI/180.0;
T = (t+sectors)*M_PI/180.0;
x[2] = sin(P) * cos(T) ;
y[2] = sin(P) * sin(T) ;
z[2] = cos(P);
pos_sphere.push_back(R * x[2]);
pos_sphere.push_back(R * y[2]);
pos_sphere.push_back(R * z[2]);
normals.push_back(x[2]);
normals.push_back(y[2]);
normals.push_back(z[2]);
//D
P = (p+rings)*M_PI/180.0;
T = (t+sectors)*M_PI/180.0;
x[3] = sin(P) * cos(T) ;
y[3] = sin(P) * sin(T) ;
z[3] = cos(P);
pos_sphere.push_back(R * x[3]);
pos_sphere.push_back(R * y[3]);
pos_sphere.push_back(R * z[3]);
normals.push_back(x[3]);
normals.push_back(y[3]);
normals.push_back(z[3]);
pos_sphere.push_back(R * x[1]);
pos_sphere.push_back(R * y[1]);
pos_sphere.push_back(R * z[1]);
normals.push_back(x[1]);
normals.push_back(y[1]);
normals.push_back(z[1]);
pos_sphere.push_back(R * x[2]);
pos_sphere.push_back(R * y[2]);
pos_sphere.push_back(R * z[2]);
normals.push_back(x[2]);
normals.push_back(y[2]);
normals.push_back(z[2]);
}
//Bottom of the sphere
for(int t=0; t<360; t+=sectors)
{
pos_sphere.push_back(0);
pos_sphere.push_back(0);
pos_sphere.push_back(-R);
normals.push_back(0);
normals.push_back(0);
normals.push_back(-1);
P = (180-rings)*M_PI/180.0;
T = t*M_PI/180.0;
x[1] = sin(P) * cos(T) ;
y[1] = sin(P) * sin(T) ;
z[1] = cos(P);
pos_sphere.push_back(R * x[1]);
pos_sphere.push_back(R * y[1]);
pos_sphere.push_back(R * z[1]);
normals.push_back(x[1]);
normals.push_back(y[1]);
normals.push_back(z[1]);
P = (180-rings)*M_PI/180.0;
T = (t+sectors)*M_PI/180.0;
x[2] = sin(P) * cos(T) ;
y[2] = sin(P) * sin(T) ;
z[2] = cos(P);
pos_sphere.push_back(R * x[2]);
pos_sphere.push_back(R * y[2]);
pos_sphere.push_back(R * z[2]);
normals.push_back(x[2]);
normals.push_back(y[2]);
normals.push_back(z[2]);
}
trivial_center.push_back(0.0);trivial_center.push_back(0.0);trivial_center.push_back(0.0);
}
//The intersection spheres
{
pos_sphere_inter.resize(0);
int rings=3,sectors=3;
float T, P, R = 0.005f;
float x[4],y[4],z[4];
//Top of the sphere
for(int t=0; t<360; t+=sectors)
{
pos_sphere_inter.push_back(0);
pos_sphere_inter.push_back(0);
pos_sphere_inter.push_back(R);
normals_inter.push_back(0);
normals_inter.push_back(0);
normals_inter.push_back(1);
P = rings*M_PI/180.0;
T = t*M_PI/180.0;
x[1] = sin(P) * cos(T) ;
y[1] = sin(P) * sin(T) ;
z[1] = cos(P);
pos_sphere_inter.push_back(R * x[1]);
pos_sphere_inter.push_back(R * y[1]);
pos_sphere_inter.push_back(R * z[1]);
normals_inter.push_back(x[1]);
normals_inter.push_back(y[1]);
normals_inter.push_back(z[1]);
//
P = rings*M_PI/180.0;
T = (t+sectors)*M_PI/180.0;
x[2] = sin(P) * cos(T) ;
y[2] = sin(P) * sin(T) ;
z[2] = cos(P);
pos_sphere_inter.push_back(R * x[2]);
pos_sphere_inter.push_back(R * y[2]);
pos_sphere_inter.push_back(R * z[2]);
normals_inter.push_back(x[2]);
normals_inter.push_back(y[2]);
normals_inter.push_back(z[2]);
}
//Body of the sphere
for (int p=rings; p<180-rings; p+=rings)
for(int t=0; t<360; t+=sectors)
{
//A
P = p*M_PI/180.0;
T = t*M_PI/180.0;
x[0] = sin(P) * cos(T) ;
y[0] = sin(P) * sin(T) ;
z[0] = cos(P);
pos_sphere_inter.push_back(R * x[0]);
pos_sphere_inter.push_back(R * y[0]);
pos_sphere_inter.push_back(R * z[0]);
normals_inter.push_back(x[0]);
normals_inter.push_back(y[0]);
normals_inter.push_back(z[0]);
//B
P = (p+rings)*M_PI/180.0;
T = t*M_PI/180.0;
x[1] = sin(P) * cos(T) ;
y[1] = sin(P) * sin(T) ;
z[1] = cos(P);
pos_sphere_inter.push_back(R * x[1]);
pos_sphere_inter.push_back(R * y[1]);
pos_sphere_inter.push_back(R * z[1]);
normals_inter.push_back(x[1]);
normals_inter.push_back(y[1]);
normals_inter.push_back(z[1]);
//C
P = p*M_PI/180.0;
T = (t+sectors)*M_PI/180.0;
x[2] = sin(P) * cos(T) ;
y[2] = sin(P) * sin(T) ;
z[2] = cos(P);
pos_sphere_inter.push_back(R * x[2]);
pos_sphere_inter.push_back(R * y[2]);
pos_sphere_inter.push_back(R * z[2]);
normals_inter.push_back(x[2]);
normals_inter.push_back(y[2]);
normals_inter.push_back(z[2]);
//D
P = (p+rings)*M_PI/180.0;
T = (t+sectors)*M_PI/180.0;
x[3] = sin(P) * cos(T) ;
y[3] = sin(P) * sin(T) ;
z[3] = cos(P);
pos_sphere_inter.push_back(R * x[3]);
pos_sphere_inter.push_back(R * y[3]);
pos_sphere_inter.push_back(R * z[3]);
normals_inter.push_back(x[3]);
normals_inter.push_back(y[3]);
normals_inter.push_back(z[3]);
pos_sphere_inter.push_back(R * x[1]);
pos_sphere_inter.push_back(R * y[1]);
pos_sphere_inter.push_back(R * z[1]);
normals_inter.push_back(x[1]);
normals_inter.push_back(y[1]);
normals_inter.push_back(z[1]);
pos_sphere_inter.push_back(R * x[2]);
pos_sphere_inter.push_back(R * y[2]);
pos_sphere_inter.push_back(R * z[2]);
normals_inter.push_back(x[2]);
normals_inter.push_back(y[2]);
normals_inter.push_back(z[2]);
}
//Bottom of the sphere
for(int t=0; t<360; t+=sectors)
{
pos_sphere_inter.push_back(0);
pos_sphere_inter.push_back(0);
pos_sphere_inter.push_back(-R);
normals_inter.push_back(0);
normals_inter.push_back(0);
normals_inter.push_back(-1);
P = (180-rings)*M_PI/180.0;
T = t*M_PI/180.0;
x[1] = sin(P) * cos(T) ;
y[1] = sin(P) * sin(T) ;
z[1] = cos(P);
pos_sphere_inter.push_back(R * x[1]);
pos_sphere_inter.push_back(R * y[1]);
pos_sphere_inter.push_back(R * z[1]);
normals_inter.push_back(x[1]);
normals_inter.push_back(y[1]);
normals_inter.push_back(z[1]);
P = (180-rings)*M_PI/180.0;
T = (t+sectors)*M_PI/180.0;
x[2] = sin(P) * cos(T) ;
y[2] = sin(P) * sin(T) ;
z[2] = cos(P);
pos_sphere_inter.push_back(R * x[2]);
pos_sphere_inter.push_back(R * y[2]);
pos_sphere_inter.push_back(R * z[2]);
normals_inter.push_back(x[2]);
normals_inter.push_back(y[2]);
normals_inter.push_back(z[2]);
}
}
//init
{
pos_points.resize(0);
pos_lines.resize(0);
// Restore previous viewer state.
restoreStateFromFile();
//random generator of points within a sphere
typedef CGAL::Creator_uniform_3<EPIC::FT,EPIC::Point_3> Creator;
CGAL::Random_points_in_sphere_3<EPIC::Point_3, Creator> gen;
const unsigned nb_circles=20;
//vector to store input points
std::vector<EPIC::Point_3> points;
points.reserve(nb_circles);
for (unsigned i=0;i<nb_circles;++i){
EPIC::Point_3 p=*++gen;
//prevent great circles
while (p.x()==0 && p.y()==0 && p.z()==0) { p=*++gen; }
const EPIC::Point_3 origin(0,0,0);
const EPIC::Plane_3 plane(p, p-origin);
EPIC::Vector_3 base1=plane.base1();
EPIC::Vector_3 base2=plane.base2();
base1=base1/CGAL::sqrt(base1.squared_length());
base2=base2/CGAL::sqrt(base2.squared_length());
const double radius=CGAL::sqrt( CGAL::to_double( 1 - CGAL::squared_distance(origin,p) ) );
const double nb_pt_per_circle=100;
const double step=2 * CGAL_PI / nb_pt_per_circle;
for (double theta = 0; theta < 2 * CGAL_PI-step ; theta += step) {
const EPIC::Point_3 a=p + ( radius*cos(theta)*base1 + radius*sin(theta)*base2 );
const EPIC::Point_3 b=p + ( radius*cos(theta+step)*base1 + radius*sin(theta+step)*base2 );
pos_lines.push_back(a.x());pos_lines.push_back(a.y());pos_lines.push_back(a.z());
normals_lines.push_back(a.x());normals_lines.push_back(a.y());normals_lines.push_back(a.z());
pos_lines.push_back(b.x());pos_lines.push_back(b.y());pos_lines.push_back(b.z());
normals_lines.push_back(b.x());normals_lines.push_back(b.y());normals_lines.push_back(b.z());
}
points.push_back(p);
}
std::vector<EPIC::Point_3> intersections;
naive_compute_intersection_points(points,std::back_inserter(intersections));
//draw points as small spheres
for (std::vector<EPIC::Point_3>::const_iterator it=intersections.begin();it!=intersections.end();++it){
pos_points.push_back(it->x()); pos_points.push_back(it->y()); pos_points.push_back(it->z());
}
}
}
void Viewer::attrib_buffers(QGLViewer* viewer)
{
QMatrix4x4 mvpMatrix;
QMatrix4x4 mvMatrix;
double mat[16];
viewer->camera()->getModelViewProjectionMatrix(mat);
for(int i=0; i < 16; i++)
{
mvpMatrix.data()[i] = (float)mat[i];
}
viewer->camera()->getModelViewMatrix(mat);
for(int i=0; i < 16; i++)
{
mvMatrix.data()[i] = (float)mat[i];
}
// define material
QVector4D ambient(0.1f, 0.1f, 0.1f, 1.0f);
QVector4D diffuse( 0.9f,
0.9f,
0.9f,
0.0f );
QVector4D specular( 0.0f,
0.0f,
0.0f,
0.0f );
QVector4D position( -1.2f, 1.2f, .9797958971f, 1.0f );
GLfloat shininess = 1.0f;
rendering_program.bind();
mvpLocation = rendering_program.uniformLocation("mvp_matrix");
mvLocation = rendering_program.uniformLocation("mv_matrix");
colorLocation = rendering_program.uniformLocation("color");
lightLocation[0] = rendering_program.uniformLocation("light_pos");
lightLocation[1] = rendering_program.uniformLocation("light_diff");
lightLocation[2] = rendering_program.uniformLocation("light_spec");
lightLocation[3] = rendering_program.uniformLocation("light_amb");
lightLocation[4] = rendering_program.uniformLocation("spec_power");
rendering_program.setUniformValue(lightLocation[0], position);
rendering_program.setUniformValue(lightLocation[1], diffuse);
rendering_program.setUniformValue(lightLocation[2], specular);
rendering_program.setUniformValue(lightLocation[3], ambient);
rendering_program.setUniformValue(lightLocation[4], shininess);
rendering_program.setUniformValue(mvpLocation, mvpMatrix);
rendering_program.setUniformValue(mvLocation, mvMatrix);
rendering_program.release();
}
void Viewer::draw()
{
const int sphere_res=30;
//draw central sphere
::glPushMatrix();
::glColor3f(1,1,1);
::gluSphere(qsphere,0.999,sphere_res,sphere_res);
::glCallList(dl_nb);
::glCallList(dl_nb+1);
::glPopMatrix();
QColor color;
//sphere
vao[0].bind();
attrib_buffers(this);
rendering_program.bind();
color.setRgbF(1.0f, 1.0f, 1.0f);
rendering_program.setUniformValue(colorLocation, color);
glDrawArraysInstanced(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_sphere.size()/3), 1);
rendering_program.release();
vao[0].release();
//intersection
vao[2].bind();
attrib_buffers(this);
rendering_program.bind();
color.setRgbF(0.0f, 1.0f, 0.0f);
rendering_program.setUniformValue(colorLocation, color);
glDrawArraysInstanced(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_sphere_inter.size()/3), static_cast<GLsizei>(pos_points.size()/3));
rendering_program.release();
vao[2].release();
//circles
vao[1].bind();
attrib_buffers(this);
rendering_program.bind();
color.setRgbF(1.0f, 0.0f, 0.0f);
rendering_program.setUniformValue(colorLocation, color);
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_lines.size()/3));
rendering_program.release();
vao[1].release();
}
void Viewer::init()
{
// Restore previous viewer state.
restoreStateFromFile();
//init quadric to store sphere.
qsphere=gluNewQuadric();
gluQuadricOrientation(qsphere,GLU_OUTSIDE);
//code for antialiasing
::glEnable(GL_BLEND);
::glEnable(GL_LINE_SMOOTH);
::glEnable(GL_POINT_SMOOTH);
::glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
compile_shaders();
compute_elements();
initialize_buffers();
::glEnable(GL_BLEND);
//set intersection point size
::glPointSize(5);
//random generator of points within a sphere
typedef CGAL::Creator_uniform_3<EPIC::FT,EPIC::Point_3> Creator;
CGAL::Random_points_in_sphere_3<EPIC::Point_3, Creator> gen;
const unsigned nb_circles=20;
//vector to store input points
std::vector<EPIC::Point_3> points;
points.reserve(nb_circles);
//disable lighting before drawing segments and points
::glEnable(GL_LIGHTING);
//init call lists
dl_nb=::glGenLists(2);
//store circles in a display list
::glNewList(dl_nb,GL_COMPILE);
::glColor3f(1,0,0);
for (unsigned i=0;i<nb_circles;++i){
EPIC::Point_3 p=*++gen;
//prevent great circles
while (p.x()==0 && p.y()==0 && p.z()==0) { p=*++gen; }
draw_circle_on_unit_sphere(p);
points.push_back(p);
}
::glEndList();
std::vector<EPIC::Point_3> intersections;
naive_compute_intersection_points(points,std::back_inserter(intersections));
::glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
::glNewList(dl_nb+1,GL_COMPILE);
::glColor3f(0,1,0);
//draw points as small spheres
for (std::vector<EPIC::Point_3>::const_iterator it=intersections.begin();it!=intersections.end();++it){
glPushMatrix();
glTranslatef(it->x(),it->y(),it->z());
gluSphere(qsphere,0.005,10,10);
glPopMatrix();
}
::glEndList();
//lighting
::glEnable(GL_LIGHT0);
::glEnable(GL_LIGHTING);
float lpos[4] = { -.2f, .2f, .9797958971f, 0.0f };
::glLightfv(GL_LIGHT0,GL_POSITION,lpos);
::glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, 1.0f);
::glEnable(GL_NORMALIZE);
::glShadeModel(GL_SMOOTH);
}
template<class Output_iterator>
void Viewer::naive_compute_intersection_points(const std::vector<EPIC::Point_3>& points,Output_iterator out) const {
typedef CGAL::Exact_spherical_kernel_3 SK;
SK::Sphere_3 sphere(SK::Point_3(0,0,0),1);
//converter point to exact SK point type
CGAL::Cartesian_converter<EPIC,SK> to_exact;
std::vector<SK::Circle_3> circles;
//create circles from points: need to use a converter to change floating points coordinates into an exact NT.
for (std::vector<EPIC::Point_3>::const_iterator it=points.begin();it!=points.end();++it){
const SK::Point_3 center=to_exact(*it);
circles.push_back( SK::Circle_3(sphere,SK::Plane_3(center,center-CGAL::ORIGIN) ) );
}
//Look for intersection points among pair of circles: use a naive and quadratic way
for (std::vector<SK::Circle_3>::const_iterator it_f=circles.begin();it_f!=--circles.end();++it_f){
std::vector<SK::Circle_3>::const_iterator it_s=it_f;
++it_s;
for (;it_s!=circles.end();++it_s){
std::vector <CGAL::Object> intersections;
//ensure_circles are different
CGAL_precondition(*it_s!=*it_f);
CGAL::intersection(*it_f,*it_s,std::back_inserter(intersections));
if (!intersections.empty()){
for (std::vector <CGAL::Object>::const_iterator it_pt=intersections.begin();it_pt!=intersections.end();++it_pt){
const std::pair<SK::Circular_arc_point_3,unsigned>* pt=
CGAL::object_cast< std::pair<SK::Circular_arc_point_3,unsigned> > (&(*it_pt));
assert(pt!=NULL);
*out++=EPIC::Point_3( CGAL::to_double(pt->first.x()),
CGAL::to_double(pt->first.y()),
CGAL::to_double(pt->first.z())
);
}
}
typedef CGAL::Exact_spherical_kernel_3 SK;
SK::Sphere_3 sphere(SK::Point_3(0,0,0),1);
//converter point to exact SK point type
CGAL::Cartesian_converter<EPIC,SK> to_exact;
std::vector<SK::Circle_3> circles;
//create circles from points: need to use a converter to change floating points coordinates into an exact NT.
for (std::vector<EPIC::Point_3>::const_iterator it=points.begin();it!=points.end();++it){
const SK::Point_3 center=to_exact(*it);
circles.push_back( SK::Circle_3(sphere,SK::Plane_3(center,center-CGAL::ORIGIN) ) );
}
//Look for intersection points among pair of circles: use a naive and quadratic way
for (std::vector<SK::Circle_3>::const_iterator it_f=circles.begin();it_f!=--circles.end();++it_f){
std::vector<SK::Circle_3>::const_iterator it_s=it_f;
++it_s;
for (;it_s!=circles.end();++it_s){
std::vector <CGAL::Object> intersections;
//ensure_circles are different
CGAL_precondition(*it_s!=*it_f);
CGAL::intersection(*it_f,*it_s,std::back_inserter(intersections));
if (!intersections.empty()){
for (std::vector <CGAL::Object>::const_iterator it_pt=intersections.begin();it_pt!=intersections.end();++it_pt){
const std::pair<SK::Circular_arc_point_3,unsigned>* pt=
CGAL::object_cast< std::pair<SK::Circular_arc_point_3,unsigned> > (&(*it_pt));
assert(pt!=NULL);
*out++=EPIC::Point_3( CGAL::to_double(pt->first.x()),
CGAL::to_double(pt->first.y()),
CGAL::to_double(pt->first.z())
);
}
}
}
}
}
}

View File

@ -1,18 +1,52 @@
#include <QGLViewer/qglviewer.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/glu.h>
#include <QOpenGLFunctions_3_3_Core>
#include <QOpenGLVertexArrayObject>
#include <QOpenGLBuffer>
#include <QOpenGLShaderProgram>
typedef CGAL::Exact_predicates_inexact_constructions_kernel EPIC;
class Viewer : public QGLViewer
class Viewer : public QGLViewer, QOpenGLFunctions_3_3_Core
{
GLUquadricObj *qsphere;
public:
Viewer(QWidget* parent = 0);
GLuint dl_nb;
protected :
virtual void draw();
virtual void init();
template <class Kernel>
void draw_circle_on_unit_sphere(const typename CGAL::Point_3<Kernel>&) const;
template<class Output_iterator>
void naive_compute_intersection_points(const std::vector<EPIC::Point_3>&,Output_iterator) const;
private:
//Shaders elements
int vertexLocation[3];
int normalsLocation[3];
int centerLocation;
int trivialCenterLocation;
int mvpLocation;
int mvLocation;
int colorLocation;
int lightLocation[5];
std::vector<float> pos_points;
std::vector<float> pos_lines;
std::vector<float> pos_sphere;
std::vector<float> pos_sphere_inter;
std::vector<float> normals;
std::vector<float> normals_inter;
std::vector<float> trivial_center;
std::vector<float> normals_lines;
QOpenGLBuffer buffers[9];
QOpenGLVertexArrayObject vao[3];
QOpenGLShaderProgram rendering_program;
void initialize_buffers();
void compute_elements();
void attrib_buffers(QGLViewer*);
void compile_shaders();
};

View File

@ -2,11 +2,9 @@
project( Convex_decomposition_3 )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt3 )
@ -14,7 +12,7 @@ include( ${CGAL_USE_FILE} )
find_package(Qt3-patched)
# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so
# that it can be used together with FindQt4: all its variables are prefixed
# that it can be used together with Qt5: all its variables are prefixed
# by "QT3_" instead of "QT_".
if ( CGAL_FOUND AND QT3_FOUND AND CGAL_Qt3_FOUND)

View File

@ -2,11 +2,9 @@
project( convex_hull_2 )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt3 )
@ -14,7 +12,7 @@ include( ${CGAL_USE_FILE} )
find_package(Qt3-patched)
# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so
# that it can be used together with FindQt4: all its variables are prefixed
# that it can be used together with Qt5: all its variables are prefixed
# by "QT3_" instead of "QT_".
if ( CGAL_FOUND AND CGAL_Qt3_FOUND AND QT3_FOUND )

View File

@ -4,11 +4,9 @@
project( Convex_hull_3_Demo )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL QUIET COMPONENTS Core )

View File

@ -66,10 +66,10 @@ For instance, use macports in the following way:
sudo port install cgal
</PRE>
or if Qt4 demos are desired
or if Qt5 are desired
<PRE>
sudo port install cgal +qt4 +universal +demos
sudo port install cgal +qt5 +universal +demos
</PRE>
The setup is similar for <a href="http://mxcl.github.com/homebrew/"><tt>homebrew</tt></a> .
@ -167,9 +167,7 @@ In order to build the \cgal libraries, you need a \cpp compiler.
In order to configure, build, and install the \cgal libraries, examples and
demos, you need CMake, a cross-platform "makefile generator".
If CMake is not installed already you can obtain it from <A HREF="http://www.cmake.org/">`http://www.cmake.org/`</A>.
CMake version 2.6.3 or higher is required. On Windows, CMake
version 2.8.6 or higher is required, for a proper support of DLL's
generation.
CMake version 2.8.11 or higher is required.
This manual explains only those features of
CMake which are needed in order to build \cgal. Please refer to the
CMake documentation at <A HREF="http://www.cmake.org/">`http://www.cmake.org/`</A> for further details.
@ -185,8 +183,7 @@ Visual \cpp solution and project file that you can use to build \cgal.
\subsection installation_configuring_gui Configuring CGAL with the CMake GUI
The simplest way to start the configuration is to run the graphical
user interface of CMake. We recommend to use `cmake-gui`. It
is available on many platforms as of CMake version 2.6. You must pass as
user interface of CMake. We recommend to use `cmake-gui`. You must pass as
argument the root directory of \cgal. For example:
<PRE>
@ -298,8 +295,7 @@ We next list the libraries and essential 3rd party software
| `CGAL_Core` | `WITH_CGAL_Core` | The CORE library for algebraic numbers.\cgalFootnote{CGAL_Core is not part of \cgal, but a custom version of the \sc{Core} library distributed by \cgal for the user convenience and it has it's own license.} | \sc{Gmp} and \sc{Mpfr} |
| `CGAL_ImageIO` | `WITH_CGAL_ImageIO` | Utilities to read and write image files | \sc{OpenGL}, \sc{zlib}, \sc{Vtk}(optional) |
| `CGAL_Qt3` | `WITH_CGAL_Qt3` | `CGAL::Qt_widget` used by \sc{Qt}3-based demos | \sc{Qt}3 and \sc{OpenGL} |
| `CGAL_Qt4` | `WITH_CGAL_Qt4` | `QGraphicsView` support for \sc{Qt}4-based demos | \sc{Qt}4 and \sc{OpenGL} |
| `CGAL_Qt5` | `WITH_CGAL_Qt5` | `QGraphicsView` support for \sc{Qt}5-based demos | \sc{Qt}5 and \sc{OpenGL} |
\subsection installation_debug Debug vs. Release
@ -333,7 +329,7 @@ see \ref sec3partysoftwareconfig to specify the location of 3rd
party software.
The libraries \stl (shipped with any compiler) and \sc{Boost} are essential to all components (i.e.\ libCGAL,
libCGAL_Core, libCGAL_ImageIO, libCGAL_Qt3 and libCGAL_Qt4).
libCGAL_Core, libCGAL_ImageIO, libCGAL_Qt3 and libCGAL_Qt5).
\subsection thirdpartystl Standard Template Library (STL)
@ -375,7 +371,7 @@ As on Windows there is no canonical directory for where to find
\subsection thirdpartyMPFR GMP and MPFR
The components libCGAL, libCGAL_Core, libCGAL_Qt3 and libCGAL_Qt4 require
The components libCGAL, libCGAL_Core, libCGAL_Qt3 and libCGAL_Qt5 require
\sc{Gmp} and \sc{Mpfr} which are libraries for multi precision integers and rational numbers,
and for multi precision floating point numbers.
@ -407,25 +403,25 @@ for instance, on Windows, you can download it from <A HREF="http://www.zlib.net/
\sc{OpenGL} (Open Graphics Library) provides an API for applications that
produce 2D and 3D computer graphics.
In \cgal the library is essential for the components libCGAL_Qt3 and
libCGAL_Qt4, as well as libCGAL_ImageIO and for various demos.
In \cgal the library is essential for the components libCGAL_Qt3
and libCGAL_Qt5, as well as libCGAL_ImageIO and for various demos.
Typically, \sc{OpenGL} is preinstalled on systems; if not, it can be
downloaded from <A HREF="http://www.opengl.org/">`http://www.opengl.org/`</A>.
\subsection thirdpartyQt Qt3 and Qt4
\subsection thirdpartyQt Qt3 and Qt5
Qt is a cross-platform application and UI framework.
The component libCGAL_Qt3 requires \sc{Qt}3 installed on your system, while
the component libCGAL_Qt4 requires \sc{Qt}4 installed on your system.
the component libCGAL_Qt5 requires \sc{Qt}5 installed on your system.
In case \sc{Qt} is not yet installed on your system, you can download
it from <A HREF="http://qt-project.org/">`http://qt-project.org/`</A>.
Older demos of \cgal use libCGAL_Qt3 and \sc{Qt}3, while newer and newly
developed demos require libCGAL_Qt4 and \sc{Qt}4.
developed demos require libCGAL_Qt5 and \sc{Qt}5.
Having \sc{Qt}4 version 4.3.0 or higher is recommended.
Having \sc{Qt}4 version 4.3.0 or higher or \sc{Qt}5 version 5.3.0 is recommended.
\section installation_examples CGAL Examples and Demos
@ -510,7 +506,7 @@ The \sc{Eigen} web site is <A HREF="http://eigen.tuxfamily.org">`http://eigen.tu
\subsection thirdpartylibQGLViewer libQGLViewer
libQGLViewer is a 3D widget based on \sc{Qt} 4's `QGLWidget`.
libQGLViewer is a 3D widget based on \sc{Qt} 4's `QGLWidget`. In case of \sc{Qt}5 used, libQGLViewer needs to be recompiled with the proper \sc{Qt}5 version.
In \cgal some 3D demos are based on libQGLViewer.
@ -673,6 +669,8 @@ cmake -DWITH_examples=OFF -DWITH_demos=OFF -DCMAKE_BUILD_TYPE=Release
/path/to/unpacked/CGAL-tarball/
</PRE>
\todo update the output of cmake
<PRE>
-- The CXX compiler identification is GNU
-- The C compiler identification is GNU
@ -966,8 +964,8 @@ If the parameter is not given, the script creates <B>one executable for each giv
source file</B>.
<DT><B>`-c com1:com2:...`</B><DD> Lists components ("com1",
"com2") of \cgal to which the executable(s) should be linked. Valid components are \cgal's
libraries (i.e.\ "Core", "ImageIO", "Qt3" and "Qt4"; note
that it only make sense to either pick "Qt3" or "Qt4") and all
libraries (i.e.\ "Core", "ImageIO", "Qt3" and "Qt5"; note
that it only make sense to either pick "Qt3" or "Qt5") and all
preconfigured 3rd party software, such as "MPFI", "RS3"). An example is `-c Core:GMP:RS3:MPFI`
<DT><B>`-b boost1:boost2:...`</B><DD> Lists components ("boost1",
@ -1001,8 +999,8 @@ this file within a CMake script sets up include paths and libraries to
link with \cgal and essential third party libraries. Beyond,
`find_package` can demand for `COMPONENTS` of \cgal,
that is, all \cgal libraries `libCGAL_Core` (<i>Core</i>),
libCGAL_ImageIO (<i>ImageIO</i>) , libCGAL_Qt3 (<i>Qt3</i>) and libCGAL_Qt4
(<i>Qt4</i>) or optional 3rd party software such as <i>MPFI</i>, <i>RS3</i>.
libCGAL_ImageIO (<i>ImageIO</i>) , libCGAL_Qt3 (<i>Qt3</i>) and libCGAL_Qt5
(<i>Qt5</i>) or optional 3rd party software such as <i>MPFI</i>, <i>RS3</i>.
A user is free to create the `CMakeLists.txt`
without calling the script (manual creation).
@ -1060,7 +1058,7 @@ configure and build. Their values can be ON or OFF.
| `WITH_demos` | OFF |
| `WITH_CGAL_Core` | ON |
| `WITH_CGAL_Qt3` | ON |
| `WITH_CGAL_Qt4` | ON |
| `WITH_CGAL_Qt5` | ON |
| `WITH_CGAL_ImageIO` | ON |
\subsection installation_flags Compiler and Linker Flags
@ -1213,26 +1211,11 @@ the header files and the full pathnames of the \sc{Qt}3 libraries.
| `QT3_UIC_EXECUTABLE` | Full pathname to the uic executable of \sc{Qt}3 | CMake |
\subsection installation_qt5 Qt5 Library
\subsection installation_qt4 Qt4 Library
The CMake scripts that search for \sc{Qt}4 can use the introspection feature
of the tool `qmake` included in \sc{Qt}4 distributions. If \sc{Qt}4 is not
automatically found, it is sufficient to set the `PATH`
environment variable, so that \sc{Qt}4 `qmake` tool is in the path, and
before \sc{Qt}3 `qmake` if that one exists. One can alternatively set the
CMake variable `QT_QMAKE_EXECUTABLE`. The following variables
should be then assigned automatically by CMake.
| Variable | Description | Type |
| :- | :- | :- |
| `QT_INCLUDE_DIR` | Directory containing the `QtCore/qglobal.h` file | CMake |
|`QT_LIBRARY_DIR` | Directory containing the compiled \sc{Qt}4 libraries | CMake |
| `QT_(xyz)_LIBRARY` | Full pathname to the compiled 'xyz' \sc{Qt}4 library\cgalFootnote{If both release and debug versions are available, this variable contains a list of the following form: 'optimized;<fullpath-to-release-lib>;debug;<fullpath-to-debug-lib>', where the 'optimized' and 'debug' tags should appear verbatim.} | CMake |
| `QT_QMAKE_EXECUTABLE` | Full pathname to the qmake executable of \sc{Qt}4 | CMake |
| `QT_MOC_EXECUTABLE` | Full pathname to the moc executable of \sc{Qt}4 | CMake |
| `QT_UIC_EXECUTABLE` | Full pathname to the uic executable of \sc{Qt}4 | CMake |
You must set the cmake or environment variable `Qt5_DIR` to point to the path
to the directory containing the file `Qt5Config.cmake` created by your \sc{Qt}5 installation. If you are
using the open source edition it should be `<path>/qt-everywhere-opensource-src-<version>/qtbase/lib/cmake/Qt5`.
\subsection installation_leda LEDA Library

View File

@ -4,11 +4,9 @@
project( Envelope_3_demo )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL QUIET COMPONENTS Core Qt3 )
@ -19,7 +17,7 @@ if ( CGAL_FOUND )
find_package(Qt3-patched QUIET )
# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so
# that it can be used together with FindQt4: all its variables are prefixed
# that it can be used together with Qt5: all its variables are prefixed
# by "QT3_" instead of "QT_".
if(CGAL_Qt3_FOUND AND QT3_FOUND AND CGAL_Core_FOUND)

View File

@ -4,12 +4,8 @@
project( Filtered_kernel_test )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()
cmake_minimum_required(VERSION 2.8.11)
add_executable(bench_simple_comparisons bench_simple_comparisons.cpp)

View File

@ -4,12 +4,8 @@
project( Generator_example )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()
cmake_minimum_required(VERSION 2.8.11)
find_package(CGAL QUIET COMPONENTS Core )

View File

@ -9,7 +9,7 @@ include( ${CGAL_USE_FILE} )
find_package(Qt3-patched)
# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so
# that it can be used together with FindQt4: all its variables are prefixed
# that it can be used together with Qt5: all its variables are prefixed
# by "QT3_" instead of "QT_".
if ( CGAL_FOUND AND CGAL_Qt3_FOUND AND QT3_FOUND )

View File

@ -4,11 +4,9 @@
project( Geomview_Demo )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL QUIET COMPONENTS Core )

View File

@ -8,4 +8,4 @@ Shift: pour // aux axes.
Affichage du (x,y) par rapport à l'origine de l'objet en cours.
Integrer src/CGALQt4 dans le build process de CGAL, avec CMake.
Integrer src/CGALQt5 dans le build process de CGAL, avec CMake.

View File

@ -186,7 +186,7 @@ void MainWindow::alphaChanged(int i)
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -211,8 +211,9 @@ MainWindow::on_actionInsertRandomPoints_triggered()
Iso_rectangle_2 isor = convert(rect);
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((isor.min)(), (isor.max)());
bool ok = false;
const int number_of_points =
QInputDialog::getInteger(this,
QInputDialog::getInt(this,
tr("Number of random points"),
tr("Enter number of random points"),
100,
@ -299,9 +300,8 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Alpha_shape_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5).
CGAL_QT_INIT_RESOURCES;
MainWindow mainWindow;
mainWindow.show();

View File

@ -3,47 +3,39 @@
project (Alpha_shapes_2_demo)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4)
find_package(CGAL COMPONENTS Qt5)
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)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
include_directories (BEFORE ../../include)
include_directories (BEFORE ./include)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
#--------------------------------
# The "Delaunay" demo: Alpha_shapes_2
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( DT_UI_FILES Alpha_shapes_2.ui )
qt5_wrap_ui( DT_UI_FILES Alpha_shapes_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( DT_RESOURCE_FILES ./Alpha_shapes_2.qrc )
qt5_add_resources ( DT_RESOURCE_FILES ./Alpha_shapes_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( Alpha_shapes_2.cpp Alpha_shapes_2.moc )
qt5_generate_moc( Alpha_shapes_2.cpp Alpha_shapes_2.moc )
# The executable itself.
add_executable ( Alpha_shapes_2 Alpha_shapes_2.cpp Alpha_shapes_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
qt5_use_modules(Alpha_shapes_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Alpha_shapes_2 )
# Link with Qt libraries
@ -53,6 +45,6 @@ target_link_libraries( Alpha_shapes_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARI
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
endif()

View File

@ -151,7 +151,7 @@ MainWindow::processInput(CGAL::Object o)
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -176,15 +176,16 @@ MainWindow::on_actionInsertRandomPoints_triggered()
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((isor.min)(), (isor.max)());
bool ok = false;
const int number_of_points =
QInputDialog::getInteger(this,
QInputDialog::getInt(this,
tr("Number of random points"),
tr("Enter number of random points"),
100,
0,
(std::numeric_limits<int>::max)(),
1,
&ok);
100,
0,
(std::numeric_limits<int>::max)(),
1,
&ok);
if(!ok) {
return;
@ -282,9 +283,9 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Apollonius_graph_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5).
// See http://doc.qt.io/qt-5/qdir.html#Q_INIT_RESOURCE
CGAL_QT_INIT_RESOURCES;
Q_INIT_RESOURCE(Apollonius_graph_2);
MainWindow mainWindow;

View File

@ -3,45 +3,37 @@
project (Apollonius_graph_2_demo)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4)
find_package(CGAL COMPONENTS Qt5)
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)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
include_directories (BEFORE ../../include)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( DT_UI_FILES Apollonius_graph_2.ui )
qt5_wrap_ui( DT_UI_FILES Apollonius_graph_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( DT_RESOURCE_FILES ./Apollonius_graph_2.qrc )
qt5_add_resources ( DT_RESOURCE_FILES ./Apollonius_graph_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( Apollonius_graph_2.cpp Apollonius_graph_2.moc )
qt5_generate_moc( Apollonius_graph_2.cpp Apollonius_graph_2.moc )
# The executable itself.
add_executable ( Apollonius_graph_2 Apollonius_graph_2.cpp Apollonius_graph_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
qt5_use_modules(Apollonius_graph_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Apollonius_graph_2 )
# Link with Qt libraries
@ -51,6 +43,6 @@ target_link_libraries( Apollonius_graph_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIB
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
endif()

View File

@ -350,7 +350,7 @@ MainWindow::processInput(CGAL::Object o)
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -435,8 +435,9 @@ MainWindow::on_actionInsertRandomPoints_triggered()
Iso_rectangle_2 isor = convert(rect);
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((isor.min)(), (isor.max)());
bool ok = false;
const int number_of_points =
QInputDialog::getInteger(this,
QInputDialog::getInt(this,
tr("Number of random points"),
tr("Enter number of random points"),
100,
@ -539,9 +540,9 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Bounding_volumes demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5).
// See http://doc.qt.io/qt-5/qdir.html#Q_INIT_RESOURCE
CGAL_QT_INIT_RESOURCES;
MainWindow mainWindow;
mainWindow.show();

View File

@ -3,49 +3,42 @@
project (Bounding_volumes)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4)
find_package(CGAL COMPONENTS Qt5)
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)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
include_directories (BEFORE ../../include)
include_directories (BEFORE ./include)
include_directories (BEFORE ../../../Matrix_search/include)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
#----------------------------------------------
# The "Bounding volumes" demo: Bounding_volumes
#----------------------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( DT_UI_FILES Bounding_volumes.ui )
qt5_wrap_ui( DT_UI_FILES Bounding_volumes.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( DT_RESOURCE_FILES ./Bounding_volumes.qrc )
qt5_add_resources ( DT_RESOURCE_FILES ./Bounding_volumes.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( "Bounding_volumes.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Bounding_volumes.moc" )
qt5_generate_moc( "Bounding_volumes.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Bounding_volumes.moc" )
# The executable itself.
add_executable ( Bounding_volumes Bounding_volumes.cpp Bounding_volumes.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
qt5_use_modules(Bounding_volumes Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Bounding_volumes )
# Link with Qt libraries
@ -55,6 +48,6 @@ target_link_libraries( Bounding_volumes ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRA
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
endif()

View File

@ -3,46 +3,42 @@
project (Circular_kernel_2)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4)
find_package(CGAL COMPONENTS Qt5)
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)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
include_directories (BEFORE ../../include)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
#--------------------------------
# The demo: Circular_kernel_2
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( DT_UI_FILES Circular_kernel_2.ui )
qt5_wrap_ui( DT_UI_FILES Circular_kernel_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( DT_RESOURCE_FILES ./Circular_kernel_2.qrc )
qt5_add_resources ( DT_RESOURCE_FILES ./Circular_kernel_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( "Circular_kernel_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Circular_kernel_2.moc" )
qt5_generate_moc( "Circular_kernel_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Circular_kernel_2.moc" )
# The executable itself.
add_executable ( Circular_kernel_2 Circular_kernel_2.cpp Circular_kernel_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
qt5_use_modules(Circular_kernel_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Circular_kernel_2 )
# Link with Qt libraries
@ -52,6 +48,6 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
endif()

View File

@ -181,7 +181,7 @@ MainWindow::processInput(CGAL::Object o)
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -287,9 +287,8 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Circular_kernel_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5).
CGAL_QT_INIT_RESOURCES;
MainWindow mainWindow;
mainWindow.show();

View File

@ -3,44 +3,39 @@
project (GeneratorDemo)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4)
find_package(CGAL COMPONENTS Qt5)
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)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
include_directories (BEFORE ../../include)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
#--------------------------------
# Demo: Generator_2
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( DT_UI_FILES Generator_2.ui )
qt5_wrap_ui( DT_UI_FILES Generator_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( DT_RESOURCE_FILES ./Generator_2.qrc )
qt5_add_resources ( DT_RESOURCE_FILES ./Generator_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( "Generator_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Generator_2.moc" )
qt5_generate_moc( "Generator_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Generator_2.moc" )
# The executable itself.
add_executable ( Generator_2 Generator_2.cpp Generator_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
qt5_use_modules(Generator_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Generator_2 )
# Link with Qt libraries
@ -50,6 +45,6 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
else()
message(STATUS "NOTICE: This demo requires CGAL, and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled.")
endif()

View File

@ -13,6 +13,7 @@
// Qt headers
#include <QtGui>
#include <QString>
#include <QInputDialog>
#include <QFileDialog>
#include <QGraphicsLineItem>
@ -65,8 +66,9 @@ private:
G pg(radius);
bool ok = false;
const int number_of_points =
QInputDialog::getInteger(this,
const int number_of_points =
QInputDialog::getInt(this,
tr("Number of random points"),
tr("Enter number of random points"),
100,
@ -170,7 +172,7 @@ MainWindow::MainWindow()
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -283,7 +285,7 @@ MainWindow::on_actionGeneratePolytopeInDisc_triggered()
//G pg(radius);
bool ok = false;
const int number_of_points =
QInputDialog::getInteger(this,
QInputDialog::getInt(this,
tr("Number of random points in the disc"),
tr("Enter number of random points.\nThe polytope will be the convex hull of these points."),
100,
@ -336,9 +338,9 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Generator_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5).
// See http://doc.qt.io/qt-5/qdir.html#Q_INIT_RESOURCE
CGAL_QT_INIT_RESOURCES;
Q_INIT_RESOURCE(Generator_2);
MainWindow mainWindow;

View File

@ -2,34 +2,25 @@
project (GraphicsView)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4)
find_package(CGAL COMPONENTS Qt5)
include(${CGAL_USE_FILE})
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
set( QT_USE_QTXML TRUE )
set( QT_USE_QTMAIN TRUE )
set( QT_USE_QTSCRIPT TRUE )
set( QT_USE_QTOPENGL TRUE )
find_package(Qt4)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
add_executable ( min min.cpp )
qt5_use_modules(min Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS min )
# Link with Qt libraries
@ -39,6 +30,6 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
endif()

View File

@ -4,6 +4,9 @@
#include <CGAL/Qt/GraphicsViewNavigation.h>
#include <QLineF>
#include <QRectF>
#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsView>
int main(int argc, char **argv)
{

View File

@ -3,48 +3,41 @@
project (L1_voronoi_diagram_2)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4)
find_package(CGAL COMPONENTS Qt5)
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)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
include_directories (BEFORE ../../include)
include_directories (BEFORE ./include)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
#--------------------------------
# The "L1 Voronoi diagram" demo: L1_voronoi_diagram_2
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( DT_UI_FILES L1_voronoi_diagram_2.ui )
qt5_wrap_ui( DT_UI_FILES L1_voronoi_diagram_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( DT_RESOURCE_FILES ./L1_voronoi_diagram_2.qrc )
qt5_add_resources ( DT_RESOURCE_FILES ./L1_voronoi_diagram_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( L1_voronoi_diagram_2.cpp L1_voronoi_diagram_2.moc )
qt5_generate_moc( L1_voronoi_diagram_2.cpp L1_voronoi_diagram_2.moc )
# The executable itself.
add_executable ( L1_voronoi_diagram_2 L1_voronoi_diagram_2.cpp L1_voronoi_diagram_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
qt5_use_modules(L1_voronoi_diagram_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS L1_voronoi_diagram_2 )
# Link with Qt libraries
@ -54,6 +47,6 @@ target_link_libraries( L1_voronoi_diagram_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_L
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
endif()

View File

@ -213,7 +213,7 @@ MainWindow::processInput(CGAL::Object o)
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -245,8 +245,9 @@ MainWindow::on_actionInsertRandomPoints_triggered()
Iso_rectangle_2 isor = convert(rect);
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((isor.min)(), (isor.max)());
bool ok = false;
const int number_of_points =
QInputDialog::getInteger(this,
QInputDialog::getInt(this,
tr("Number of random points"),
tr("Enter number of random points"),
100,
@ -385,9 +386,9 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("L1 Voronoi diagram_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5).
CGAL_QT_INIT_RESOURCES;
MainWindow mainWindow;
mainWindow.show();
return app.exec();

View File

@ -3,46 +3,40 @@
project (Largest_empty_rectangleDemo)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4)
find_package(CGAL COMPONENTS Qt5)
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)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
include_directories (BEFORE ../../include)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
#--------------------------------
# Demo: Largest_empty_rectangle_2
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( DT_UI_FILES Largest_empty_rectangle_2.ui )
qt5_wrap_ui( DT_UI_FILES Largest_empty_rectangle_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( DT_RESOURCE_FILES ./Largest_empty_rectangle_2.qrc )
qt5_add_resources ( DT_RESOURCE_FILES ./Largest_empty_rectangle_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( Largest_empty_rectangle_2.cpp Largest_empty_rectangle_2.moc )
qt5_generate_moc( Largest_empty_rectangle_2.cpp Largest_empty_rectangle_2.moc )
# The executable itself.
add_executable ( Largest_empty_rectangle_2 Largest_empty_rectangle_2.cpp Largest_empty_rectangle_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
qt5_use_modules(Largest_empty_rectangle_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Largest_empty_rectangle_2 )
# Link with Qt libraries
@ -52,6 +46,6 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
else()
message(STATUS "NOTICE: This demo requires CGAL, and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled.")
endif()

View File

@ -8,6 +8,7 @@
#include <QtGui>
#include <QString>
#include <QFileDialog>
#include <QInputDialog>
#include <QGraphicsRectItem>
#include <QGraphicsLineItem>
@ -60,8 +61,9 @@ private:
G pg(radius);
bool ok = false;
const int number_of_points =
QInputDialog::getInteger(this,
QInputDialog::getInt(this,
tr("Number of random points"),
tr("Enter number of random points"),
100,
@ -183,7 +185,7 @@ MainWindow::MainWindow()
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -275,9 +277,9 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Largest_empty_rectangle_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5).
// See http://doc.qt.io/qt-5/qdir.html#Q_INIT_RESOURCE
CGAL_QT_INIT_RESOURCES;
Q_INIT_RESOURCE(Largest_empty_rectangle_2);
MainWindow mainWindow;

View File

@ -1,43 +1,36 @@
cmake_minimum_required(VERSION 2.4.5)
project (Periodic_2_Triangulation_2_demo)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
if ( COMMAND cmake_policy )
cmake_policy( SET CMP0003 NEW )
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4 REQUIRED)
find_package(CGAL COMPONENTS Qt5)
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)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
include_directories (BEFORE ../../../include)
include_directories (BEFORE ./include)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
#--------------------------------
# The "2D Periodic triangulation" demo: Periodic_2_triangulation_2
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( DT_UI_FILES Periodic_2_triangulation_2.ui )
qt5_wrap_ui( DT_UI_FILES Periodic_2_triangulation_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( DT_RESOURCE_FILES ./Periodic_2_triangulation_2.qrc )
qt5_add_resources ( DT_RESOURCE_FILES ./Periodic_2_triangulation_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( Periodic_2_Delaunay_triangulation_2.cpp Periodic_2_triangulation_2.moc )
qt5_generate_moc( Periodic_2_Delaunay_triangulation_2.cpp Periodic_2_triangulation_2.moc )
# find header files for projects that can show them
file(GLOB headers "*.h")
@ -53,6 +46,8 @@ add_executable ( Periodic_2_Delaunay_triangulation_2
${DT_UI_FILES} ${DT_RESOURCE_FILES}
${headers} ${QT_headers} ${P2T2_headers})
qt5_use_modules( Periodic_2_Delaunay_triangulation_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Periodic_2_Delaunay_triangulation_2 )
# Link with Qt libraries
@ -61,6 +56,6 @@ target_link_libraries( Periodic_2_Delaunay_triangulation_2 ${QT_LIBRARIES} )
target_link_libraries( Periodic_2_Delaunay_triangulation_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
endif()

View File

@ -216,7 +216,7 @@ MainWindow::processInput(CGAL::Object o)
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -294,8 +294,9 @@ MainWindow::on_actionInsertRandomPoints_triggered()
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((triang.domain().min)(),
(triang.domain().max)());
bool ok = false;
const int number_of_points =
QInputDialog::getInteger(this,
QInputDialog::getInt(this,
tr("Number of random points"),
tr("Enter number of random points"),
250,
@ -442,9 +443,9 @@ int main(int argc, char **argv)
app.setOrganizationName("Nico Kruithof");
app.setApplicationName("Periodic_2_Delaunay_triangulation_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5).
// See http://doc.qt.io/qt-5/qdir.html#Q_INIT_RESOURCE
CGAL_QT_INIT_RESOURCES;
MainWindow mainWindow;
mainWindow.show();

View File

@ -3,27 +3,20 @@
project (GraphicsView)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4 Core)
find_package(CGAL COMPONENTS Qt5 Core)
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)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
include_directories (BEFORE ../../include)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
@ -31,18 +24,17 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
add_definitions(-DCGAL_USE_CORE)
endif()
include(${QT_USE_FILE})
#--------------------------------
# Demo: Polygon_2
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( DT_UI_FILES Polygon_2.ui )
qt5_wrap_ui( DT_UI_FILES Polygon_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( DT_RESOURCE_FILES ./Polygon_2.qrc )
qt5_add_resources ( DT_RESOURCE_FILES ./Polygon_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( Polygon_2.cpp "${CMAKE_CURRENT_BINARY_DIR}/Polygon_2.moc" )
qt5_generate_moc( Polygon_2.cpp "${CMAKE_CURRENT_BINARY_DIR}/Polygon_2.moc" )
# add_library( CGAL SHARED IMPORTED )
# SET_PROPERTY(TARGET CGAL PROPERTY IMPORTED_LOCATION ${CGAL_LIBRARY} )
@ -50,6 +42,8 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
# The executable itself.
add_executable ( Polygon_2 Polygon_2.cpp Polygon_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
qt5_use_modules(Polygon_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polygon_2 )
@ -60,6 +54,6 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
else()
message(STATUS "NOTICE: This demo requires CGAL, CGAL_Core, and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL, CGAL_Core, and Qt5, and will not be compiled.")
endif()

View File

@ -16,6 +16,7 @@
#include <QtGui>
#include <QString>
#include <QFileDialog>
#include <QInputDialog>
#include <QGraphicsLineItem>
// GraphicsView items and event filters (input classes)
@ -205,7 +206,7 @@ MainWindow::processInput(CGAL::Object o)
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -571,9 +572,9 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Polygon_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5).
// See http://doc.qt.io/qt-5/qdir.html#Q_INIT_RESOURCE
CGAL_QT_INIT_RESOURCES;
Q_INIT_RESOURCE(Polygon_2);
MainWindow mainWindow;

View File

@ -3,14 +3,12 @@
project (Segment_voronoi_2)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4 Core)
find_package(CGAL COMPONENTS Qt5 Core)
include(${CGAL_USE_FILE})
@ -20,32 +18,32 @@ set( QT_USE_QTSCRIPT TRUE )
set( QT_USE_QTOPENGL TRUE )
find_package(Qt4)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
include_directories (BEFORE ../../include)
include_directories (BEFORE ./include)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
#--------------------------------
# The "Segment Voronoi" demo: Segment_voronoi_2
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( CDT_UI_FILES Segment_voronoi_2.ui )
qt5_wrap_ui( CDT_UI_FILES Segment_voronoi_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( CDT_RESOURCE_FILES ./Segment_voronoi_2.qrc )
qt5_add_resources ( CDT_RESOURCE_FILES ./Segment_voronoi_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( "Segment_voronoi_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Segment_voronoi_2.moc" )
qt5_generate_moc( "Segment_voronoi_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Segment_voronoi_2.moc" )
# The executable itself.
add_executable ( Segment_voronoi_2 Segment_voronoi_2.cpp Segment_voronoi_2.moc ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} )
qt5_use_modules(Segment_voronoi_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Segment_voronoi_2 )
# Link with Qt libraries
@ -56,6 +54,6 @@ target_link_libraries( Segment_voronoi_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIB
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
endif()

View File

@ -17,6 +17,8 @@
#include <QInputDialog>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QMessageBox>
#include <QGraphicsLineItem>
// GraphicsView items and event filters (input classes)
#include <CGAL/Qt/GraphicsViewPolylineInput.h>
@ -210,7 +212,7 @@ MainWindow::processInput(CGAL::Object o)
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -375,9 +377,8 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Segment Voronoi 2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5).
CGAL_QT_INIT_RESOURCES;
MainWindow mainWindow;
mainWindow.show();

View File

@ -3,14 +3,12 @@
project (Segment_voronoi_linf_2)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4 Core)
find_package(CGAL COMPONENTS Qt5 Core)
include(${CGAL_USE_FILE})
@ -20,32 +18,32 @@ set( QT_USE_QTSCRIPT TRUE )
set( QT_USE_QTOPENGL TRUE )
find_package(Qt4)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
include_directories (BEFORE ../../include)
include_directories (BEFORE ./include)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
#--------------------------------
# The "Segment Voronoi Linf" demo: Segment_voronoi_linf_2
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( CDT_UI_FILES Segment_voronoi_2.ui )
qt5_wrap_ui( CDT_UI_FILES Segment_voronoi_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( CDT_RESOURCE_FILES ./Segment_voronoi_2.qrc )
qt5_add_resources ( CDT_RESOURCE_FILES ./Segment_voronoi_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( "Segment_voronoi_linf_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Segment_voronoi_linf_2.moc" )
qt5_generate_moc( "Segment_voronoi_linf_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Segment_voronoi_linf_2.moc" )
# The executable itself.
add_executable ( Segment_voronoi_linf_2 Segment_voronoi_linf_2.cpp Segment_voronoi_linf_2.moc ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} )
qt5_use_modules(Segment_voronoi_linf_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Segment_voronoi_linf_2 )
# Link with Qt libraries
@ -56,6 +54,6 @@ target_link_libraries( Segment_voronoi_linf_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PART
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
endif()

View File

@ -1,8 +1,9 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>GeometryFactory</author>
<class>Segment_voronoi_2</class>
<widget class="QMainWindow" name="Segment_voronoi_2" >
<property name="geometry" >
<widget class="QMainWindow" name="Segment_voronoi_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@ -10,240 +11,233 @@
<height>600</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>CGAL Segment Voronoi Diagram</string>
</property>
<property name="windowIcon" >
<iconset resource="../resources/CGAL.qrc" >
<property name="windowIcon">
<iconset resource="../resources/CGAL.qrc">
<normaloff>:/cgal/logos/cgal_icon</normaloff>:/cgal/logos/cgal_icon</iconset>
</property>
<widget class="QWidget" name="centralwidget" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QGraphicsView" name="graphicsView" >
<property name="focusPolicy" >
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QGraphicsView" name="graphicsView">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="verticalScrollBarPolicy" >
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy" >
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="transformationAnchor" >
<property name="transformationAnchor">
<enum>QGraphicsView::NoAnchor</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar" />
<widget class="QToolBar" name="fileToolBar" >
<property name="windowTitle" >
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="fileToolBar">
<property name="windowTitle">
<string>File Tools</string>
</property>
<attribute name="toolBarArea" >
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak" >
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionClear" />
<addaction name="actionLoadSegments" />
<addaction name="actionSaveSegments" />
<addaction name="actionClear"/>
<addaction name="actionLoadSegments"/>
<addaction name="actionSaveSegments"/>
</widget>
<widget class="QToolBar" name="toolBar" >
<property name="windowTitle" >
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>Visualization Tools</string>
</property>
<attribute name="toolBarArea" >
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak" >
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionInsertPolyline" />
<addaction name="separator" />
<addaction name="actionShowConstraints" />
<addaction name="actionShowVoronoi" />
<addaction name="separator" />
<addaction name="actionRecenter" />
<addaction name="actionInsertPolyline"/>
<addaction name="separator"/>
<addaction name="actionShowVoronoi"/>
<addaction name="separator"/>
<addaction name="actionRecenter"/>
</widget>
<widget class="QMenuBar" name="menubar" >
<property name="geometry" >
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>19</height>
<height>26</height>
</rect>
</property>
<widget class="QMenu" name="menuFile" >
<property name="title" >
<widget class="QMenu" name="menuFile">
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="separator" />
<addaction name="actionClear" />
<addaction name="actionLoadSegments" />
<addaction name="actionSaveSegments" />
<addaction name="separator" />
<addaction name="actionQuit" />
<addaction name="separator"/>
<addaction name="actionClear"/>
<addaction name="actionLoadSegments"/>
<addaction name="actionSaveSegments"/>
<addaction name="separator"/>
<addaction name="actionQuit"/>
</widget>
<widget class="QMenu" name="menuEdit" >
<property name="title" >
<widget class="QMenu" name="menuEdit">
<property name="title">
<string>&amp;Edit</string>
</property>
</widget>
<widget class="QMenu" name="menuTools" >
<property name="title" >
<widget class="QMenu" name="menuTools">
<property name="title">
<string>&amp;Tools</string>
</property>
<addaction name="actionInsertPolyline" />
<addaction name="separator" />
<addaction name="actionShowVoronoi" />
<addaction name="actionShowConstraints" />
<addaction name="separator" />
<addaction name="actionRecenter" />
<addaction name="actionInsertPolyline"/>
<addaction name="separator"/>
<addaction name="actionShowVoronoi"/>
<addaction name="separator"/>
<addaction name="actionRecenter"/>
</widget>
<addaction name="menuFile" />
<addaction name="menuEdit" />
<addaction name="menuTools" />
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
<addaction name="menuTools"/>
</widget>
<action name="actionAbout" >
<property name="text" >
<action name="actionAbout">
<property name="text">
<string>&amp;About</string>
</property>
</action>
<action name="actionAboutCGAL" >
<property name="text" >
<action name="actionAboutCGAL">
<property name="text">
<string>About &amp;CGAL</string>
</property>
</action>
<action name="actionQuit" >
<property name="text" >
<action name="actionQuit">
<property name="text">
<string>&amp;Quit</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
</action>
<action name="actionInsertPolyline" >
<property name="checkable" >
<action name="actionInsertPolyline">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked" >
<property name="checked">
<bool>false</bool>
</property>
<property name="icon" >
<iconset resource="../icons/Input.qrc" >
<property name="icon">
<iconset resource="../icons/Input.qrc">
<normaloff>:/cgal/Input/inputPolyline.png</normaloff>:/cgal/Input/inputPolyline.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>&amp;Insert Polyline</string>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>Insert Point or Polyline</string>
</property>
<property name="statusTip" >
<property name="statusTip">
<string>Left: Insert vtx | Right: Final vtx | Del: Delete vtx</string>
</property>
</action>
<action name="actionClear" >
<property name="icon" >
<iconset resource="../icons/File.qrc" >
<action name="actionClear">
<property name="icon">
<iconset resource="../icons/File.qrc">
<normaloff>:/cgal/fileToolbar/fileNew.png</normaloff>:/cgal/fileToolbar/fileNew.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>&amp;Clear</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>Ctrl+C</string>
</property>
</action>
<action name="actionShowVoronoi" >
<property name="checkable" >
<action name="actionShowVoronoi">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked" >
<property name="checked">
<bool>false</bool>
</property>
<property name="icon" >
<iconset resource="../icons/Triangulation_2.qrc" >
<property name="icon">
<iconset resource="../icons/Triangulation_2.qrc">
<normaloff>:/cgal/Triangulation_2/Voronoi_diagram_2.png</normaloff>:/cgal/Triangulation_2/Voronoi_diagram_2.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Show &amp;Voronoi Diagram</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>Ctrl+V</string>
</property>
<property name="visible" >
<property name="visible">
<bool>false</bool>
</property>
</action>
<action name="actionLoadSegments" >
<property name="icon" >
<iconset resource="../icons/File.qrc" >
<action name="actionLoadSegments">
<property name="icon">
<iconset resource="../icons/File.qrc">
<normaloff>:/cgal/fileToolbar/fileOpen.png</normaloff>:/cgal/fileToolbar/fileOpen.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>&amp;Load...</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>Ctrl+L</string>
</property>
</action>
<action name="actionSaveSegments" >
<property name="icon" >
<iconset resource="../icons/File.qrc" >
<action name="actionSaveSegments">
<property name="icon">
<iconset resource="../icons/File.qrc">
<normaloff>:/cgal/fileToolbar/fileSave.png</normaloff>:/cgal/fileToolbar/fileSave.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>&amp;Save...</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
<action name="actionRecenter" >
<property name="icon" >
<iconset resource="../icons/Input.qrc" >
<action name="actionRecenter">
<property name="icon">
<iconset resource="../icons/Input.qrc">
<normaloff>:/cgal/Input/zoom-best-fit</normaloff>:/cgal/Input/zoom-best-fit</iconset>
</property>
<property name="text" >
<property name="text">
<string>Re&amp;center the viewport</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>Ctrl+R</string>
</property>
</action>
<action name="actionShowConstraints" >
<property name="checkable" >
<action name="actionShowConstraints">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon" >
<iconset resource="Segment_voronoi_2.qrc" >
<property name="icon">
<iconset resource="Segment_voronoi_2.qrc">
<normaloff>:/cgal/Actions/icons/constrained_triangulation_show_constraints.png</normaloff>:/cgal/Actions/icons/constrained_triangulation_show_constraints.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Show &amp;constraints</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>Ctrl+C</string>
</property>
</action>
</widget>
<resources>
<include location="Segment_voronoi_2.qrc" />
<include location="../icons/File.qrc" />
<include location="../resources/CGAL.qrc" />
<include location="../icons/Triangulation_2.qrc" />
<include location="../icons/Input.qrc" />
<include location="Segment_voronoi_2.qrc"/>
<include location="../icons/File.qrc"/>
<include location="../resources/CGAL.qrc"/>
<include location="../icons/Triangulation_2.qrc"/>
<include location="../icons/Input.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -17,7 +17,7 @@
#include <QInputDialog>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QMessageBox>
// GraphicsView items and event filters (input classes)
#include <CGAL/Qt/GraphicsViewPolylineInput.h>
#include <CGAL/Qt/SegmentDelaunayGraphLinfGraphicsItem.h>
@ -458,9 +458,8 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Segment Voronoi 2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5)
CGAL_QT_INIT_RESOURCES;
if (argc == 2) {
has_file_argument = true;

View File

@ -1,10 +1,10 @@
<html>
<body>
<h2>Constrained Delaunay Triangulation</h2>
<p>Copyright &copy; 2008 GeometryFactory</p>
<p>This application illustrates the 2D Constrained Delaunay
<h2>L Infinity Segment Delaunay Graphs</h2>
<p>Copyright &copy; 2015 GeometryFactory</p>
<p>This application illustrates the 2D L infinity segment Delaunay graph.
of <a href="http://www.cgal.org/">CGAL</a>.</p>
<p>See also <a href="http://www.cgal.org/Pkg/Triangulation2">the online
<p>See also <a href="http://www.cgal.org/Pkg/SDGLinf">the online
manual</a>.</p>
</body>
</html>

View File

@ -3,47 +3,39 @@
project (Snap_rounding_2_demo)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4)
find_package(CGAL COMPONENTS Qt5)
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)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
include_directories (BEFORE ../../include)
include_directories (BEFORE ../../../Snap_rounding_2/include)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( DT_UI_FILES Snap_rounding_2.ui )
qt5_wrap_ui( DT_UI_FILES Snap_rounding_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( DT_RESOURCE_FILES ./Snap_rounding_2.qrc )
qt5_add_resources ( DT_RESOURCE_FILES ./Snap_rounding_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( Snap_rounding_2.cpp Snap_rounding_2.moc )
qt5_generate_moc( Snap_rounding_2.cpp Snap_rounding_2.moc )
# The executable itself.
add_executable ( Snap_rounding_2 Snap_rounding_2.cpp Snap_rounding_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
qt5_use_modules(Snap_rounding_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Snap_rounding_2 )
# Link with Qt libraries
@ -53,6 +45,6 @@ target_link_libraries( Snap_rounding_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRAR
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
endif()

View File

@ -198,7 +198,7 @@ MainWindow::processInput(CGAL::Object o)
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -306,9 +306,9 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Snap_rounding_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5).
// See http://doc.qt.io/qt-5/qdir.html#Q_INIT_RESOURCE
CGAL_QT_INIT_RESOURCES;
Q_INIT_RESOURCE(Snap_rounding_2);
MainWindow mainWindow;

View File

@ -3,47 +3,41 @@
project (Spatial_searchingDemo)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4)
find_package(CGAL COMPONENTS Qt5)
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)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
include_directories (BEFORE ../../include)
include_directories (BEFORE ../../../Spatial_searching/include)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
#--------------------------------
# Demo: Spatial_searching_2
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( DT_UI_FILES Spatial_searching_2.ui )
qt5_wrap_ui( DT_UI_FILES Spatial_searching_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( DT_RESOURCE_FILES ./Spatial_searching_2.qrc )
qt5_add_resources ( DT_RESOURCE_FILES ./Spatial_searching_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( Spatial_searching_2.cpp Spatial_searching_2.moc )
qt5_generate_moc( Spatial_searching_2.cpp Spatial_searching_2.moc )
# The executable itself.
add_executable ( Spatial_searching_2 Spatial_searching_2.cpp Spatial_searching_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
qt5_use_modules(Spatial_searching_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Spatial_searching_2 )
# Link with Qt libraries
@ -53,6 +47,6 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
else()
message(STATUS "NOTICE: This demo requires CGAL, and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled.")
endif()

View File

@ -9,6 +9,7 @@
#include <QtGui>
#include <QString>
#include <QFileDialog>
#include <QInputDialog>
#include <QGraphicsLineItem>
// GraphicsView items and event filters (input classes)
@ -66,8 +67,9 @@ public:
G pg(radius);
bool ok = false;
const int number_of_points =
QInputDialog::getInteger(this,
QInputDialog::getInt(this,
tr("Number of random points"),
tr("Enter number of random points"),
100,
@ -186,7 +188,7 @@ void MainWindow::N_changed(int i)
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -288,9 +290,9 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Spatial_searching_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5).
// See http://doc.qt.io/qt-5/qdir.html#Q_INIT_RESOURCE
CGAL_QT_INIT_RESOURCES;
Q_INIT_RESOURCE(Spatial_searching_2);
MainWindow mainWindow;

View File

@ -3,46 +3,40 @@
project (Stream_lines_2_demo)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4)
find_package(CGAL COMPONENTS Qt5)
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)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
include_directories (BEFORE ../../include)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( DT_UI_FILES Stream_lines_2.ui )
qt5_wrap_ui( DT_UI_FILES Stream_lines_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( DT_RESOURCE_FILES ./Stream_lines_2.qrc )
qt5_add_resources ( DT_RESOURCE_FILES ./Stream_lines_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( Stream_lines_2.cpp Stream_lines_2.moc )
qt5_generate_moc( Stream_lines_2.cpp Stream_lines_2.moc )
# The executable itself.
add_executable ( Stream_lines_2 Stream_lines_2.cpp Stream_lines_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
qt5_use_modules(Stream_lines_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Stream_lines_2 )
# Link with Qt libraries
@ -52,6 +46,6 @@ target_link_libraries( Stream_lines_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARI
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
endif()

View File

@ -122,7 +122,7 @@ MainWindow::MainWindow()
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -239,9 +239,9 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Stream_lines_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5).
// See http://doc.qt.io/qt-5/qdir.html#Q_INIT_RESOURCE
CGAL_QT_INIT_RESOURCES;
Q_INIT_RESOURCE(Stream_lines_2);
MainWindow mainWindow;

View File

@ -3,24 +3,17 @@
project (Triangulation_2)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
find_package(CGAL COMPONENTS Qt4)
find_package(CGAL COMPONENTS Qt5)
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)
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
include_directories (BEFORE ../../include)
include_directories (BEFORE ./include)
@ -28,26 +21,29 @@ include_directories (BEFORE ../../../Number_types/include)
include_directories (BEFORE ../../../Triangulation_2/include)
if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND )
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
add_definitions(-DQT_NO_KEYWORDS)
include(${QT_USE_FILE})
#--------------------------------
# The "constrained Delaunay" demo: Constrained_Delaunay_triangulation_2
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( CDT_UI_FILES Constrained_Delaunay_triangulation_2.ui )
qt5_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 )
qt5_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" "${CMAKE_CURRENT_BINARY_DIR}/Constrained_Delaunay_triangulation_2.moc" )
qt5_generate_moc( "Constrained_Delaunay_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Constrained_Delaunay_triangulation_2.moc" )
# The executable itself.
add_executable ( Constrained_Delaunay_triangulation_2 Constrained_Delaunay_triangulation_2.cpp Constrained_Delaunay_triangulation_2.moc ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} )
qt5_use_modules(Constrained_Delaunay_triangulation_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Constrained_Delaunay_triangulation_2 )
# Link with Qt libraries
@ -59,17 +55,19 @@ target_link_libraries( Constrained_Delaunay_triangulation_2 ${CGAL_LIBRARIES} $
# The "Delaunay" demo: Delaunay_triangulation_2
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( DT_UI_FILES Delaunay_triangulation_2.ui )
qt5_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 )
qt5_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" "${CMAKE_CURRENT_BINARY_DIR}/Delaunay_triangulation_2.moc" )
qt5_generate_moc( "Delaunay_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Delaunay_triangulation_2.moc" )
# The executable itself.
add_executable ( Delaunay_triangulation_2 Delaunay_triangulation_2.cpp Delaunay_triangulation_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
qt5_use_modules(Delaunay_triangulation_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Delaunay_triangulation_2 )
# Link with Qt libraries
@ -81,17 +79,19 @@ target_link_libraries( Delaunay_triangulation_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PAR
# The "Regular" demo: Regular_triangulation_2
#--------------------------------
# UI files (Qt Designer files)
qt4_wrap_ui( DT_UI_FILES Regular_triangulation_2.ui )
qt5_wrap_ui( DT_UI_FILES Regular_triangulation_2.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( DT_RESOURCE_FILES ./Regular_triangulation_2.qrc )
qt5_add_resources ( DT_RESOURCE_FILES ./Regular_triangulation_2.qrc )
# use the Qt MOC preprocessor on classes that derives from QObject
qt4_generate_moc( "Regular_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Regular_triangulation_2.moc" )
qt5_generate_moc( "Regular_triangulation_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Regular_triangulation_2.moc" )
# The executable itself.
add_executable ( Regular_triangulation_2 Regular_triangulation_2.cpp Regular_triangulation_2.moc ${DT_UI_FILES} ${DT_RESOURCE_FILES} )
qt5_use_modules(Regular_triangulation_2 Xml Script OpenGL Svg)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Regular_triangulation_2 )
# Link with Qt libraries
@ -101,6 +101,6 @@ target_link_libraries( Regular_triangulation_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PART
else()
message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
endif()

View File

@ -45,6 +45,7 @@
// for viewportsBbox(QGraphicsScene*)
#include <CGAL/Qt/utility.h>
#include <QDebug>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_2 Point_2;
@ -83,7 +84,7 @@ discoverInfiniteComponent(const CDT & ct)
Face_handle fh = queue.front();
queue.pop_front();
fh->set_in_domain(false);
for(int i = 0; i < 3; i++)
{
Face_handle fi = fh->neighbor(i);
@ -95,7 +96,7 @@ discoverInfiniteComponent(const CDT & ct)
}
template<typename SeedList>
void
void
discoverComponents(const CDT & ct,
const SeedList& seeds)
{
@ -212,7 +213,7 @@ public Q_SLOTS:
void on_actionShow_seeds_toggled(bool checked);
void on_actionInsertPolyline_toggled(bool checked);
void on_actionInsertSeeds_OnOff_toggled(bool checked);
void on_actionCircumcenter_toggled(bool checked);
@ -267,7 +268,7 @@ MainWindow::MainWindow()
QObject::connect(this, SIGNAL(changed()),
dgi, SLOT(modelChanged()));
qDebug()<<"setting des Pens";
dgi->setVerticesPen(
QPen(Qt::red, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
dgi->setVoronoiPen(
@ -284,10 +285,10 @@ MainWindow::MainWindow()
pi = new CGAL::Qt::GraphicsViewPolylineInput<K>(this, &scene, 0, true); // inputs polylines which are not closed
QObject::connect(pi, SIGNAL(generate(CGAL::Object)),
this, SLOT(processInput(CGAL::Object)));
tcc = new CGAL::Qt::TriangulationCircumcircle<CDT>(&scene, &cdt, this);
tcc->setPen(QPen(Qt::red, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
dms = new CGAL::Qt::DelaunayMeshInsertSeeds<CDT>(&scene, &cdt, this);//input seeds
QObject::connect(dms, SIGNAL(generate(CGAL::Object)),
this, SLOT(processInput(CGAL::Object)));
@ -351,7 +352,7 @@ MainWindow::processInput(CGAL::Object o)
cdt.insert(points.front());
else
insert_polyline(points.begin(), points.end());
}
}
else
{
// Seed (from Shift + left clic)
@ -371,7 +372,7 @@ MainWindow::processInput(CGAL::Object o)
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -777,8 +778,9 @@ MainWindow::on_actionInsertRandomPoints_triggered()
Iso_rectangle_2 isor = convert(rect);
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((isor.min)(), (isor.max)());
bool ok = false;
const int number_of_points =
QInputDialog::getInteger(this,
QInputDialog::getInt(this,
tr("Number of random points"),
tr("Enter number of random points"),
100,
@ -855,9 +857,8 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Constrained_Delaunay_triangulation_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5).
CGAL_QT_INIT_RESOURCES;
MainWindow mainWindow;
mainWindow.show();

View File

@ -197,7 +197,7 @@ MainWindow::processInput(CGAL::Object o)
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -281,8 +281,9 @@ MainWindow::on_actionInsertRandomPoints_triggered()
Iso_rectangle_2 isor = convert(rect);
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((isor.min)(), (isor.max)());
bool ok = false;
const int number_of_points =
QInputDialog::getInteger(this,
QInputDialog::getInt(this,
tr("Number of random points"),
tr("Enter number of random points"),
100,
@ -383,9 +384,8 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Delaunay_triangulation_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (QT5).
CGAL_QT_INIT_RESOURCES;
MainWindow mainWindow;
mainWindow.show();

View File

@ -168,7 +168,7 @@ MainWindow::processInput(CGAL::Object o)
/*
* Qt Automatic Connections
* http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
* http://doc.qt.io/qt-5/designer-using-a-ui-file.html#automatic-connections
*
* setupUi(this) generates connections to the slots named
* "on_<action_name>_<signal_name>"
@ -215,9 +215,10 @@ MainWindow::on_actionInsertRandomPoints_triggered()
QRectF rect = CGAL::Qt::viewportsBbox(&scene);
CGAL::Qt::Converter<K> convert;
Iso_rectangle_2 isor = convert(rect);
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((isor.min)(), (isor.max)());
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((isor.min)(), (isor.max)());
const int number_of_points =
QInputDialog::getInteger(this,
QInputDialog::getInt(this,
tr("Number of random points"),
tr("Enter number of random points"), 100, 0);
@ -295,9 +296,8 @@ int main(int argc, char **argv)
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Regular_triangulation_2 demo");
// Import resources from libCGALQt4.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
CGAL_QT4_INIT_RESOURCES;
// Import resources from libCGAL (Qt5).
CGAL_QT_INIT_RESOURCES;
MainWindow mainWindow;
mainWindow.show();

View File

@ -8,17 +8,17 @@ namespace CGAL {
\cgalAutoToc
\authors Andreas Fabri and Laurent Rineau
<A HREF="http://qt-project.org/doc/qt-4.8/">Qt</A> is a <span class="textsc">Gui</span> toolkit for
<A HREF="http://qt-project.org/doc/qt-5/">Qt</A> is a <span class="textsc">Gui</span> toolkit for
cross-platform application development.
\section GraphicsViewIntroduction Introduction
This chapter describes classes that help to visualize two dimensional \cgal objects
with the <A HREF="http://qt-project.org/doc/qt-4.8/graphicsview.html">Qt Graphics View Framework</A>.
with the <A HREF="http://qt-project.org/doc/qt-5/graphicsview.html">Qt Graphics View Framework</A>.
This framework uses the model view paradigm. <A HREF="http://qt-project.org/doc/qt-4.8/qgraphicsitem.html">`QGraphicsItem`</A>s are stored in a
<A HREF="http://qt-project.org/doc/qt-4.8/qgraphicsscene.html">`QGraphicsScene`</A>
and are displayed in a <A HREF="http://qt-project.org/doc/qt-4.8/qgraphicsview.html">`QGraphicsView`</A>. The items
This framework uses the model view paradigm. <A HREF="http://qt-project.org/doc/qt-5/qgraphicsitem.html">`QGraphicsItem`</A>s are stored in a
<A HREF="http://qt-project.org/doc/qt-5/qgraphicsscene.html">`QGraphicsScene`</A>
and are displayed in a <A HREF="http://qt-project.org/doc/qt-5/qgraphicsview.html">`QGraphicsView`</A>. The items
have a paint method which is called when an item is in the visible area of a view.
The framework is also responsible for dispatching events from the view
via the scene to the items. The framework is extensible in the sense
@ -50,14 +50,14 @@ classes that have to override member functions adhering to this naming scheme.
\section GraphicsViewOverall Overall Design
In \cgalFigureRef{graphicsviewuml} you see four classes depicted in grey,
that come from the %Qt Graphics View Framework. The <A HREF="http://qt-project.org/doc/qt-4.8/qgraphicsscene.html">`QGraphicsScene`</A>
contains <A HREF="http://qt-project.org/doc/qt-4.8/qgraphicsitem.html">`QGraphicsItem`</A>s, which get displayed in any number
of <A HREF="http://qt-project.org/doc/qt-4.8/qgraphicsview.html">`QGraphicsView`</A>s. The views are widgets, that is they take screen space
that come from the %Qt Graphics View Framework. The <A HREF="http://qt-project.org/doc/qt-5/qgraphicsscene.html">`QGraphicsScene`</A>
contains <A HREF="http://qt-project.org/doc/qt-5/qgraphicsitem.html">`QGraphicsItem`</A>s, which get displayed in any number
of <A HREF="http://qt-project.org/doc/qt-5/qgraphicsview.html">`QGraphicsView`</A>s. The views are widgets, that is they take screen space
in an application.
The fourth class is the <A HREF="http://qt-project.org/doc/qt-4.8/qobject.html">`QObject`</A>. It plays an important role in %Qt for
event handling and memory management. First, it allows to add <A HREF="http://qt-project.org/doc/qt-4.8/signalsandslots.html">signals and
slots</A>, and to connect them. Second, it allows to install <A HREF="http://qt-project.org/doc/qt-4.8/eventsandfilters.html">event filters</A>.
The fourth class is the <A HREF="http://qt-project.org/doc/qt-5/qobject.html">`QObject`</A>. It plays an important role in %Qt for
event handling and memory management. First, it allows to add <A HREF="http://qt-project.org/doc/qt-5/signalsandslots.html">signals and
slots</A>, and to connect them. Second, it allows to install <A HREF="http://qt-project.org/doc/qt-5/eventsandfilters.html">event filters</A>.
\cgalFigureBegin{graphicsviewuml,uml-design.png}
UML Class Diagram with the %Qt classes (blue), \cgal classes for using the framework (yellow), \cgal data structures (red), and application classes (green).
@ -68,8 +68,8 @@ UML Class Diagram with the %Qt classes (blue), \cgal classes for using the frame
In order to visualize for example a `CGAL::Delaunay_triangulation_2`, we
provide the graphics item class `CGAL::Qt::TriangulationGraphicsItem<T>`.
It provides a `paint` method that draws the edges and vertices of a triangulation
using the drawing primitives of the <A HREF="http://qt-project.org/doc/qt-4.8/qpainter.html">`QPainter`</A>. The color of vertices and edges,
can be chosen by setting a user defined <A HREF="http://qt-project.org/doc/qt-4.8/qpen.html">`QPen`</A>.
using the drawing primitives of the <A HREF="http://qt-project.org/doc/qt-5/qpainter.html">`QPainter`</A>. The color of vertices and edges,
can be chosen by setting a user defined <A HREF="http://qt-project.org/doc/qt-5/qpen.html">`QPen`</A>.
As this graphics item only stores a pointer to a triangulation, it
must be notified about changes like the insertion of points coming from

Some files were not shown because too many files have changed in this diff Show More