new T3 demo using Qt4 and QGLViewer

This demo was written in the framework of the GSoC by Fei (Sophie) Che, co-mentored by Manuel and me.
This commit is contained in:
Monique Teillaud 2010-12-20 13:31:30 +00:00
parent a363b9f1fa
commit 543fec7ccf
41 changed files with 3515 additions and 0 deletions

40
.gitattributes vendored
View File

@ -3904,6 +3904,46 @@ Triangulation_2/doc_tex/Triangulation_2_ref/remove.gif -text svneol=unset#image/
Triangulation_2/doc_tex/Triangulation_2_ref/walk.gif -text svneol=unset#image/gif
Triangulation_2/include/CGAL/internal/Triangulation_euclidean_traits_projected_3.h -text
Triangulation_2/test/Triangulation_2/test_delaunay_triangulation_proj.cpp -text
Triangulation_3/demo/Triangulation_3/CMakeLists.txt -text
Triangulation_3/demo/Triangulation_3/MainWindow.cpp -text
Triangulation_3/demo/Triangulation_3/MainWindow.h -text
Triangulation_3/demo/Triangulation_3/PreferenceDlg.cpp -text
Triangulation_3/demo/Triangulation_3/PreferenceDlg.h -text
Triangulation_3/demo/Triangulation_3/Scene.cpp -text
Triangulation_3/demo/Triangulation_3/Scene.h -text
Triangulation_3/demo/Triangulation_3/T3_demo.cpp -text
Triangulation_3/demo/Triangulation_3/Viewer.cpp -text
Triangulation_3/demo/Triangulation_3/Viewer.h -text
Triangulation_3/demo/Triangulation_3/documentation/about.html -text
Triangulation_3/demo/Triangulation_3/documentation/about_CGAL.html -text
Triangulation_3/demo/Triangulation_3/icons/about_CGAL.html -text
Triangulation_3/demo/Triangulation_3/icons/cgal_logo.xpm -text
Triangulation_3/demo/Triangulation_3/icons/clear.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/coordinates.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/empty_sphere.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/fileOpen.png -text
Triangulation_3/demo/Triangulation_3/icons/fileSave.png -text
Triangulation_3/demo/Triangulation_3/icons/flat.png -text
Triangulation_3/demo/Triangulation_3/icons/grid.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/insert.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/insert_point.jpg -text
Triangulation_3/demo/Triangulation_3/icons/move_1.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/nearest_nb.png -text
Triangulation_3/demo/Triangulation_3/icons/normal_view.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/pause.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/play.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/pointRandom.png -text
Triangulation_3/demo/Triangulation_3/icons/preferences.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/quit.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/select_hand.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/show_delaunay.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/show_facet.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/show_point.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/show_voronoi.jpeg -text
Triangulation_3/demo/Triangulation_3/icons/stereo.png -text
Triangulation_3/demo/Triangulation_3/icons/stop.jpeg -text
Triangulation_3/demo/Triangulation_3/typedefs.h -text
Triangulation_3/demo/Triangulation_3/ui_MainWindow.h -text
Triangulation_3/demo/Triangulation_3_Geomview_demos/CMakeLists.txt -text
Triangulation_3/doc_tex/TriangulationDS_3/comborient.gif -text svneol=unset#image/gif
Triangulation_3/doc_tex/TriangulationDS_3/comborient.pdf -text svneol=unset#application/pdf

View File

@ -0,0 +1,82 @@
# Created by the script cgal_create_cmake_script
# This is the CMake script for compiling a CGAL application.
project (Triangulation_demo_3)
cmake_minimum_required(VERSION 2.4.5)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
if ( COMMAND cmake_policy )
cmake_policy( SET CMP0003 NEW )
endif()
find_package(CGAL COMPONENTS Qt4)
include(${CGAL_USE_FILE})
set( QT_USE_QTXML TRUE )
set( QT_USE_QTMAIN TRUE )
set( QT_USE_QTSCRIPT TRUE )
set( QT_USE_QTOPENGL TRUE )
set( QT_USE_QTASSISTANT TRUE )
find_package(Qt4)
find_package(OpenGL)
if(QT4_FOUND)
include( ${QT_USE_FILE} )
find_package(QGLViewer)
endif(QT4_FOUND)
if ( CGAL_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
include(${QT_USE_FILE})
include_directories (${QGLVIEWER_INCLUDE_DIR})
include_directories (BEFORE ../../include ./ )
# ui files, created with Qt Designer
qt4_wrap_ui( uis MainWindow.ui )
# qrc files (resources files, that contain icons, at least)
qt4_add_resources ( RESOURCE_FILES ./T3_demo.qrc )
# moc files (meta object compiler files, run moc preprocessor on the files with Widget defs)
qt4_automoc( MainWindow.cpp Viewer.cpp PreferenceDlg.cpp )
# cpp files
add_executable ( T3_demo T3_demo.cpp
MainWindow.cpp Viewer.cpp
PreferenceDlg.cpp
Scene.cpp ${uis} ${RESOURCE_FILES} )
add_to_cached_list( CGAL_EXECUTABLE_TARGETS T3_demo )
target_link_libraries( T3_demo ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
target_link_libraries( T3_demo ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES} )
target_link_libraries( T3_demo ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
else( CGAL_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
set(TRIANGULATION_3_MISSING_DEPS "")
if(NOT CGAL_FOUND)
set(TRIANGULATION_3_MISSING_DEPS "the CGAL Qt4 library, ${TRIANGULATION_3_MISSING_DEPS}")
endif()
if(NOT QT4_FOUND)
set(TRIANGULATION_3_MISSING_DEPS "Qt4, ${TRIANGULATION_3_MISSING_DEPS}")
endif()
if(NOT OPENGL_FOUND)
set(TRIANGULATION_3_MISSING_DEPS "OpenGL, ${TRIANGULATION_3_MISSING_DEPS}")
endif()
if(NOT QGLVIEWER_FOUND)
set(TRIANGULATION_3_MISSING_DEPS "QGLViewer, ${TRIANGULATION_3_MISSING_DEPS}")
endif()
message(STATUS "NOTICE: This demo requires ${TRIANGULATION_3_MISSING_DEPS}and will not be compiled.")
endif( CGAL_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )

View File

@ -0,0 +1,243 @@
#include "MainWindow.h"
#include <string>
#include "MainWindow.moc" // .moc will be the output from moc preprocessor
MainWindow::MainWindow(QWidget* parent)
: CGAL::Qt::DemosMainWindow(parent)
{
// Qt Automatic Connections
// http://doc.trolltech.com/4.4/designer-using-a-component.html#automatic-connections
// setupUi(this) automatically generates connections to the slots named
// "on_<action_name>_<signal_name>"
setupUi(this);
this->viewer->setScene(&m_scene);
m_scene.setViewer(this->viewer);
// setup Mode menu group actions
QActionGroup *modeGroup = new QActionGroup(this);
modeGroup->addAction(this->actionNormal_View);
modeGroup->addAction(this->actionInsert_Vertex);
modeGroup->addAction(this->actionInsert_Point);
modeGroup->addAction(this->actionSelect_Vertex);
modeGroup->addAction(this->actionMove_Vertex);
modeGroup->addAction(this->actionFind_NearestNb);
modeGroup->addAction(this->actionEmpty_Sphere);
QObject::connect(modeGroup, SIGNAL(triggered(QAction *)), this, SLOT(setMode(QAction *)));
// connect menu actions to viewer slots
connectActions();
// About menu
// addAboutCGAL() is a function in DemoMainWindow
// it will add a menu action "About CGAL..." to Help menu and connect to popupAboutCGAL
// default popupAboutCGAL points to a fixed file directory ":/cgal/help/about_CGAL.html"
// here we override it with our directory
this->addAboutCGAL();
// addAboutDemo(QString htmlResourceName) is also a function in DemoMainWindow
// it will add a menu action "About Demo..." to Help menu
// when the action is invoked, it will popup a messageBox showing the given html
this->addAboutDemo( "documentation/about.html" );
// read last setting from .ini file
viewer->readSettings();
}
void MainWindow::connectActions()
{
// Edit menu actions
QObject::connect(this->actionIncremental_Construct, SIGNAL(toggled(bool)),
this->viewer, SLOT(toggleIncremental(bool)));
QObject::connect(this->actionStop_Animation, SIGNAL(triggered()),
this->viewer, SLOT(stopIncremental()));
QObject::connect(this->viewer, SIGNAL(stopIncAnimation()),
this, SLOT(stopAnimation()));
// Show menu actions
QObject::connect(this->actionShow_Axis, SIGNAL(toggled(bool)),
this->viewer, SLOT(toggleShowAxis(bool)));
QObject::connect(this->actionShow_Vertex, SIGNAL(toggled(bool)),
this->viewer, SLOT(toggleShowVertex(bool)));
QObject::connect(this->actionShow_DEdge, SIGNAL(toggled(bool)),
this->viewer, SLOT(toggleShowDEdge(bool)));
QObject::connect(this->actionShow_VEdge, SIGNAL(toggled(bool)),
this->viewer, SLOT(toggleShowVEdge(bool)));
QObject::connect(this->actionShow_Facet, SIGNAL(toggled(bool)),
this->viewer, SLOT(toggleShowFacet(bool)));
QObject::connect(this->actionFlat, SIGNAL(toggled(bool)),
this->viewer, SLOT(toggleFlat(bool)));
// Preferences
QObject::connect(this->actionPreferences, SIGNAL(triggered()),
this->viewer, SLOT(setPreferences()));
// Help menu actions
QObject::connect(this->actionDemo_Help, SIGNAL(triggered()),
this->viewer, SLOT(help()));
QObject::connect(this->actionAbout_T3_demo, SIGNAL(triggered()),
this, SLOT(popupAboutDemo()));
// Quit
QObject::connect(this->actionQuit, SIGNAL(triggered()),
qApp, SLOT(closeAllWindows()));
// Viewer signals
QObject::connect(this, SIGNAL(sceneChanged()),
this->viewer, SLOT(updateGL()));
}
void MainWindow::closeEvent(QCloseEvent *event)
{
viewer->writeSettings();
}
/*************************************************************/
/* Action functions */
void MainWindow::setMode(QAction *action)
{
if( action == this->actionNormal_View )
this->viewer->setMode( viewer->NONE );
else if( action == this->actionInsert_Vertex )
this->viewer->setMode( viewer->INSERT_V );
else if( action == this->actionInsert_Point )
this->viewer->setMode( viewer->INSERT_PT );
else if( action == this->actionSelect_Vertex )
this->viewer->setMode( viewer->SELECT );
else if( action == this->actionMove_Vertex )
this->viewer->setMode( viewer->MOVE );
else if( action == this->actionFind_NearestNb )
this->viewer->setMode( viewer->FINDNB );
else if( action == this->actionEmpty_Sphere )
this->viewer->setMode( viewer->EMPTYSPH );
}
void MainWindow::on_actionLoad_Points_triggered()
{
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open an file"), // dialog caption
".", // initial directory
tr("OFF files (*.off);;XYZ files (*.xyz);;All files (*.*)")); // selection filter
if( fileName.isEmpty() ) return;
// erase old data
viewer->clear();
// parse fileName to get the file type
std::string fname = fileName.toAscii().data();
std::string ftype = fname.substr( fname.find_last_of('.')+1 );
if ( ftype.compare("off")==0 || ftype.compare("OFF")==0 ) { // read from OFF file
m_scene.loadPointsOFF( fname.data() );
// set selectBuffer size (if necessary)
viewer->setSelBuffSize();
} else if ( ftype.compare("xyz")==0 || ftype.compare("XYZ")==0 ) { // read from XYZ file
m_scene.loadPointsXYZ( fname.data() );
// set selectBuffer size (if necessary)
viewer->setSelBuffSize();
} else {
viewer->displayMessage( tr("Please select an OFF or XYZ file to open!") );
}
// update viewer
emit( sceneChanged() );
}
void MainWindow::on_actionSave_Points_triggered()
{
if( m_scene.isDTEmpty() ) {
viewer->displayMessage( tr("Error: no existing triangulation to be saved.") );
return;
}
QString fileName = QFileDialog::getSaveFileName(this,
tr("Save an file"), // dialog caption
".", // initial directory
tr("OFF files (*.off);;XYZ files (*.xyz);;All files (*.*)")); // selection filter
if( fileName.isEmpty() ) return;
// parse fileName to get the file type
std::string fname = fileName.toAscii().data();
std::string ftype = fname.substr( fname.find_last_of('.')+1 );
if ( ftype.compare("off")==0 || ftype.compare("OFF")==0 ) { // save to OFF file
m_scene.savePointsOFF( fname.data() );
} else if ( ftype.compare("xyz")==0 || ftype.compare("XYZ")==0 ) { // save to XYZ file
m_scene.savePointsXYZ( fname.data() );
} else {
viewer->displayMessage( tr("Please select an OFF or XYZ file to open!") );
}
}
void MainWindow::on_actionGenerate_Points_triggered()
{
bool isOk;
int nPoints = QInputDialog::getInteger(this,
"3D Triangulation demo", "Number of points: ", // caption and label
100, // default value
4, // min value
2147483647, // max value
1, // step value of arrow button
&isOk); // if OK is pressed
if ( isOk) {
// erase old data
viewer->clear();
// generate points
m_scene.generatePoints(nPoints);
// set selectBuffer size (if necessary)
viewer->setSelBuffSize();
// update viewer
emit( sceneChanged() );
}// if(isOk)
}
void MainWindow::stopAnimation()
{
if( this->actionIncremental_Construct->isChecked() )
this->actionIncremental_Construct->setChecked( false );
}
void MainWindow::on_actionClear_Scene_triggered()
{
viewer->clear();
// update viewer
emit( sceneChanged() );
}
void MainWindow::popupAboutCGAL()
{
// read contents from .html file
QFile about_CGAL( "documentation/about_CGAL.html" );
about_CGAL.open(QIODevice::ReadOnly);
QString about_CGAL_txt = QTextStream(&about_CGAL).readAll();
#ifdef CGAL_VERSION_STR
about_CGAL_txt.replace("<!--CGAL_VERSION-->",
QString(" (version %1, svn r%2)")
.arg(CGAL_VERSION_STR).arg(CGAL_SVN_REVISION));
#endif
// popup a message box
QMessageBox mb(QMessageBox::NoIcon,
tr("About CGAL..."),
about_CGAL_txt,
QMessageBox::Ok,
this);
// set links to be accessible by mouse or keyboard
QLabel* mb_label = mb.findChild<QLabel*>("qt_msgbox_label");
if(mb_label) {
mb_label->setTextInteractionFlags(mb_label->textInteractionFlags() |
::Qt::LinksAccessibleByMouse |
::Qt::LinksAccessibleByKeyboard);
} else {
std::cerr << "Cannot find child \"qt_msgbox_label\" in QMessageBox\n"
<< " with Qt version " << QT_VERSION_STR << "!\n";
}
mb.exec();
}

View File

@ -0,0 +1,55 @@
#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H
#include "ui_MainWindow.h"
#include <CGAL/Qt/DemosMainWindow.h>
#include <QFileDialog>
#include <QInputDialog>
#include <QMessageBox>
#include <QtGui>
#include "Scene.h"
class QWidget;
class MainWindow : public CGAL::Qt::DemosMainWindow, private Ui::MainWindow
{
Q_OBJECT
public:
MainWindow(QWidget* parent = 0);
~MainWindow() {}
public slots:
// file menu
void on_actionLoad_Points_triggered();
void on_actionSave_Points_triggered();
// edit menu
void on_actionGenerate_Points_triggered();
void stopAnimation();
// mode menu
void setMode(QAction *a);
// show menu
void on_actionClear_Scene_triggered();
// about menu
void popupAboutCGAL();
signals:
void sceneChanged();
protected:
void closeEvent(QCloseEvent *event);
private:
void connectActions();
private:
Scene m_scene;
};
#endif

View File

@ -0,0 +1,399 @@
#include <QtGui>
#include "PreferenceDlg.h"
#include "PreferenceDlg.moc" // .moc will be the output from moc preprocessor
PreferenceDlg::PreferenceDlg(QWidget *parent) : QDialog(parent)
{
/* Vertex */
// create groupbox
QGroupBox *groupV = new QGroupBox( tr("Vertex") );
// create buttons
QPushButton *btnVertex = new QPushButton( tr("Set Color") );
// create color label
m_labelVertex = new QLabel;
m_labelVertex->setFrameStyle(QFrame::Sunken | QFrame::Panel);
// create size label
QLabel *labelSizeV = new QLabel( tr("Set Size") );
// create lineedit
m_editSizeV = new QLineEdit;
// connect to actions
connect( btnVertex, SIGNAL(clicked()), this, SLOT(setVertexColor()) );
connect( m_editSizeV, SIGNAL(textChanged(const QString&)), this, SLOT(setVertexSize(const QString&)) );
// lay out the buttons
QGridLayout *layoutV = new QGridLayout;
layoutV->addWidget( btnVertex, 0, 0 );
layoutV->addWidget( m_labelVertex, 0, 1 );
layoutV->addWidget( labelSizeV, 1, 0 );
layoutV->addWidget( m_editSizeV, 1, 1 );
groupV->setLayout( layoutV );
/* Delaunau Edge */
// create groupbox
QGroupBox *groupDE = new QGroupBox( tr("Delaunay Edge") );
// create button
QPushButton *btnDEdge = new QPushButton( tr("Set Color") );
// create color label
m_labelDEdge = new QLabel;
m_labelDEdge->setFrameStyle(QFrame::Sunken | QFrame::Panel);
// create size label
QLabel *labelSizeDE = new QLabel( tr("Set Size") );
// create lineedit
m_editSizeDE = new QLineEdit;
// connect to actions
connect( btnDEdge, SIGNAL(clicked()), this, SLOT(setDEdgeColor()) );
connect( m_editSizeDE, SIGNAL(textChanged(const QString&)), this, SLOT(setDEdgeSize(const QString&)) );
// lay out the buttons
QGridLayout *layoutDE = new QGridLayout;
layoutDE->addWidget( btnDEdge, 0, 0 );
layoutDE->addWidget( m_labelDEdge, 0, 1 );
layoutDE->addWidget( labelSizeDE, 1, 0 );
layoutDE->addWidget( m_editSizeDE, 1, 1 );
groupDE->setLayout( layoutDE );
/* Voronoi Edge */
// create groupbox
QGroupBox *groupVE = new QGroupBox( tr("Voronoi Edge") );
// create button
QPushButton *btnVEdge = new QPushButton( tr("Set Color") );
// create color label
m_labelVEdge = new QLabel;
m_labelVEdge->setFrameStyle(QFrame::Sunken | QFrame::Panel);
// create size label
QLabel *labelSizeVE = new QLabel( tr("Set Size") );
// create lineedit
m_editSizeVE = new QLineEdit;
// connect to actions
connect( btnVEdge, SIGNAL(clicked()), this, SLOT(setVEdgeColor()) );
connect( m_editSizeVE, SIGNAL(textChanged(const QString&)), this, SLOT(setVEdgeSize(const QString&)) );
// lay out the buttons
QGridLayout *layoutVE = new QGridLayout;
layoutVE->addWidget( btnVEdge, 0, 0 );
layoutVE->addWidget( m_labelVEdge, 0, 1 );
layoutVE->addWidget( labelSizeVE, 1, 0 );
layoutVE->addWidget( m_editSizeVE, 1, 1 );
groupVE->setLayout( layoutVE );
/* Facet */
// create groupbox
QGroupBox *groupF = new QGroupBox( tr("Facet") );
// create button
QPushButton *btnFacet = new QPushButton( tr("Set Color") );
// create color label
m_labelFacet = new QLabel;
m_labelFacet->setFrameStyle(QFrame::Sunken | QFrame::Panel);
// create label and spinbox
QLabel *labelFacetA = new QLabel( tr("Transparency") );
m_spinAlphaF = new QSpinBox;
m_spinAlphaF->setRange(0, 255);
// connect to actions
connect( btnFacet, SIGNAL(clicked()), this, SLOT(setFacetColor()) );
connect( m_spinAlphaF, SIGNAL(valueChanged(int)), this, SLOT(setFacetAlpha()) );
// lay out the buttons
QGridLayout *layoutF = new QGridLayout;
layoutF->addWidget( btnFacet, 0, 0 );
layoutF->addWidget( m_labelFacet, 0, 1 );
layoutF->addWidget( labelFacetA, 1, 0 );
layoutF->addWidget( m_spinAlphaF, 1, 1 );
groupF->setLayout( layoutF );
/* Trackball */
// create groupbox
QGroupBox *groupB = new QGroupBox( tr("Trackball") );
// create button
QPushButton *btnBall = new QPushButton( tr("Set Color") );
// create color label
m_labelBall = new QLabel;
m_labelBall->setFrameStyle(QFrame::Sunken | QFrame::Panel);
// create label and spinbox
QLabel *labelBallA = new QLabel( tr("Transparency") );
m_spinAlphaB = new QSpinBox;
m_spinAlphaB->setRange(0, 255);
// create label and spinbox
QLabel *labelStep = new QLabel( tr("Step-long of Resizing") );
m_spinStep = new QSpinBox;
m_spinStep->setRange(1, 300);
// connect to actions
connect( btnBall, SIGNAL(clicked()), this, SLOT(setTrackballColor()) );
connect( m_spinAlphaB, SIGNAL(valueChanged(int)), this, SLOT(setTrackballAlpha()) );
connect( m_spinStep, SIGNAL(valueChanged(int)), this, SLOT(setStepLong()) );
// lay out the buttons
QGridLayout *layoutB = new QGridLayout;
layoutB->addWidget( btnBall, 0, 0 );
layoutB->addWidget( m_labelBall, 0, 1 );
layoutB->addWidget( labelBallA, 1, 0 );
layoutB->addWidget( m_spinAlphaB, 1, 1 );
layoutB->addWidget( labelStep, 2, 0 );
layoutB->addWidget( m_spinStep, 2, 1 );
groupB->setLayout( layoutB );
/* Empty Sphere */
// create groupbox
QGroupBox *groupS = new QGroupBox( tr("Empty Sphere") );
// create color label
m_labelSphere = new QLabel;
m_labelSphere->setFrameStyle(QFrame::Sunken | QFrame::Panel);
// create button
QPushButton *btnSphere = new QPushButton( tr("Set Color") );
// create label and spinbox
QLabel *labelSphereA = new QLabel( tr("Transparency") );
m_spinAlphaS = new QSpinBox;
m_spinAlphaS->setRange(0, 255);
// connect to actions
connect( btnSphere, SIGNAL(clicked()), this, SLOT(setEmptySphereColor()) );
connect( m_spinAlphaS, SIGNAL(valueChanged(int)), this, SLOT(setEmptySphereAlpha()) );
// lay out the buttons
QGridLayout *layoutS = new QGridLayout;
layoutS->addWidget( btnSphere, 0, 0 );
layoutS->addWidget( m_labelSphere, 0, 1 );
layoutS->addWidget( labelSphereA, 1, 0 );
layoutS->addWidget( m_spinAlphaS, 1, 1 );
groupS->setLayout( layoutS );
/* OK buttons */
// create groupbox
QGroupBox *groupBtn = new QGroupBox();
// buttons
QPushButton *ok = new QPushButton( tr("OK") );
QPushButton *apply = new QPushButton( tr("Apply") );
QPushButton *cancel = new QPushButton( tr("Cancel") );
cancel->setFocus();
// connect to actions
connect( ok, SIGNAL(clicked()), this, SLOT(okClicked()) );
connect( apply, SIGNAL(clicked()), this, SLOT(applyClicked()) );
connect( cancel, SIGNAL(clicked()), this, SLOT(reject()) );
// lay out the buttons
QGridLayout *layoutBtn = new QGridLayout;
layoutBtn->addWidget( ok, 0, 0 );
layoutBtn->addWidget( cancel, 0, 1 );
layoutBtn->addWidget( apply, 0, 2 );
groupBtn->setLayout( layoutBtn );
/* dialog layout */
// lay out the buttons
QGridLayout *main = new QGridLayout;
main->addWidget( groupV, 0, 1 );
main->addWidget( groupDE, 0, 2 );
main->addWidget( groupVE, 0, 3 );
main->addWidget( groupF, 1, 1 );
main->addWidget( groupB, 1, 2 );
main->addWidget( groupS, 1, 3 );
main->addWidget( groupBtn, 2, 2, 2, 3 );
setLayout( main );
// set dialog title
setWindowTitle( tr("Preferences") );
}
void PreferenceDlg::init(QColor clrVt, float sizeV, QColor clrDE, float sizeDE,
QColor clrVE, float sizeVE,
QColor clrF, QColor clrB, QColor clrS, int iStep)
{
// vertex color
m_colorVertex = clrVt;
// show the color in label
m_labelVertex->setText(m_colorVertex.name());
m_labelVertex->setPalette( QPalette(m_colorVertex) );
m_labelVertex->setAutoFillBackground(true);
// vertex size
m_fSizeVertex = sizeV;
m_editSizeV->setText( QString::number( m_fSizeVertex ) );
// Delaunay edge color
m_colorDEdge = clrDE;
// show the color in label
m_labelDEdge->setText( m_colorDEdge.name() );
m_labelDEdge->setPalette( QPalette(m_colorDEdge) );
m_labelDEdge->setAutoFillBackground(true);
// edge size
m_fSizeDEdge = sizeDE;
m_editSizeDE->setText( QString::number( m_fSizeDEdge ) );
// Voronoi edge color
m_colorVEdge = clrVE;
// show the color in label
m_labelVEdge->setText( m_colorVEdge.name() );
m_labelVEdge->setPalette( QPalette(m_colorVEdge) );
m_labelVEdge->setAutoFillBackground(true);
// edge size
m_fSizeVEdge = sizeVE;
m_editSizeVE->setText( QString::number( m_fSizeVEdge ) );
// facet color
m_colorFacet = clrF;
// show the color in label
m_labelFacet->setText( m_colorFacet.name() );
m_labelFacet->setPalette( QPalette(m_colorFacet) );
m_labelFacet->setAutoFillBackground(true);
// facet transparency
m_spinAlphaF->setValue( m_colorFacet.alpha() );
// trackball color
m_colorTrackball = clrB;
// show the color in label
m_labelBall->setText(m_colorTrackball.name());
m_labelBall->setPalette( QPalette(m_colorTrackball) );
m_labelBall->setAutoFillBackground(true);
// trackball transparency
m_spinAlphaB->setValue( m_colorTrackball.alpha() );
// trackball resizing fineness
m_spinStep->setValue( iStep );
// empty sphere color
m_colorEmptySphere = clrS;
// show the color in label
m_labelSphere->setText(m_colorEmptySphere.name());
m_labelSphere->setPalette( QPalette(m_colorEmptySphere) );
m_labelSphere->setAutoFillBackground(true);
// trackball transparency
m_spinAlphaS->setValue( m_colorEmptySphere.alpha() );
}
void PreferenceDlg::setVertexColor()
{
m_colorVertex = QColorDialog::getColor(m_colorVertex, this);
if( m_colorVertex.isValid() ) {
m_labelVertex->setText(m_colorVertex.name());
m_labelVertex->setPalette( QPalette(m_colorVertex) );
m_labelVertex->setAutoFillBackground(true);
}
}
void PreferenceDlg::setVertexSize(const QString& str)
{
bool ok;
float size = str.toFloat(&ok);
if( ok )
m_fSizeVertex = size;
else {
QMessageBox mb(QMessageBox::NoIcon, tr("Error!"),
tr("Enter a valid floating number."),
QMessageBox::Ok, this);
mb.exec();
m_editSizeV->setFocus();
}
}
void PreferenceDlg::setDEdgeColor()
{
m_colorDEdge = QColorDialog::getColor(m_colorDEdge, this);
if( m_colorDEdge.isValid() ) {
m_labelDEdge->setText( m_colorDEdge.name() );
m_labelDEdge->setPalette( QPalette(m_colorDEdge) );
m_labelDEdge->setAutoFillBackground(true);
}
}
void PreferenceDlg::setDEdgeSize(const QString& str)
{
bool ok;
float size = str.toFloat(&ok);
if( ok )
m_fSizeDEdge = size;
else {
QMessageBox mb(QMessageBox::NoIcon, tr("Error!"),
tr("Enter a valid floating number."),
QMessageBox::Ok, this);
mb.exec();
m_editSizeDE->setFocus();
}
}
void PreferenceDlg::setVEdgeColor()
{
m_colorVEdge = QColorDialog::getColor(m_colorVEdge, this);
if( m_colorVEdge.isValid() ) {
m_labelVEdge->setText( m_colorVEdge.name() );
m_labelVEdge->setPalette( QPalette(m_colorVEdge) );
m_labelVEdge->setAutoFillBackground(true);
}
}
void PreferenceDlg::setVEdgeSize(const QString& str)
{
bool ok;
float size = str.toFloat(&ok);
if( ok )
m_fSizeVEdge = size;
else {
QMessageBox mb(QMessageBox::NoIcon, tr("Error!"),
tr("Enter a valid floating number."),
QMessageBox::Ok, this);
mb.exec();
m_editSizeVE->setFocus();
}
}
void PreferenceDlg::setFacetColor()
{
m_colorFacet = QColorDialog::getColor(m_colorFacet, this);
if( m_colorFacet.isValid() ) {
m_labelFacet->setText( m_colorFacet.name() );
m_colorFacet.setAlpha( m_spinAlphaF->value() );
m_labelFacet->setPalette( QPalette(m_colorFacet) );
m_labelFacet->setAutoFillBackground(true);
}
}
void PreferenceDlg::setFacetAlpha()
{
m_colorFacet.setAlpha( m_spinAlphaF->value() );
}
void PreferenceDlg::setTrackballColor()
{
m_colorTrackball = QColorDialog::getColor(m_colorTrackball, this);
if( m_colorTrackball.isValid() ) {
m_labelBall->setText( m_colorTrackball.name() );
m_colorTrackball.setAlpha( m_spinAlphaB->value() );
m_labelBall->setPalette( QPalette(m_colorTrackball) );
m_labelBall->setAutoFillBackground(true);
}
}
void PreferenceDlg::setTrackballAlpha()
{
m_colorTrackball.setAlpha( m_spinAlphaB->value() );
}
void PreferenceDlg::setStepLong()
{
m_iStep = m_spinStep->value();
}
void PreferenceDlg::setEmptySphereColor()
{
m_colorEmptySphere = QColorDialog::getColor(m_colorEmptySphere, this);
if( m_colorEmptySphere.isValid() ) {
m_labelSphere->setText( m_colorEmptySphere.name() );
m_colorEmptySphere.setAlpha( m_spinAlphaS->value() );
m_labelSphere->setPalette( QPalette(m_colorEmptySphere) );
m_labelSphere->setAutoFillBackground(true);
}
}
void PreferenceDlg::setEmptySphereAlpha()
{
m_colorEmptySphere.setAlpha( m_spinAlphaS->value() );
}

View File

@ -0,0 +1,70 @@
#ifndef PREFERENCE_DLG_H
#define PREFERENCE_DLG_H
#include <QDialog>
class QLabel;
class QSpinBox;
class QLineEdit;
class PreferenceDlg : public QDialog
{
Q_OBJECT
friend class Viewer;
public:
PreferenceDlg(QWidget *parent=0);
private:
void init(QColor, float, QColor, float, QColor, float, QColor, QColor, QColor, int);
private slots:
void okClicked() { hide(); emit( applyChanges() ); }
void applyClicked() { emit( applyChanges() ); }
void setVertexColor();
void setVertexSize(const QString&);
void setDEdgeColor();
void setDEdgeSize(const QString&);
void setVEdgeColor();
void setVEdgeSize(const QString&);
void setFacetColor();
void setFacetAlpha();
void setTrackballColor();
void setTrackballAlpha();
void setStepLong();
void setEmptySphereColor();
void setEmptySphereAlpha();
signals: // Signals do not have access specifier
void applyChanges();
private:
QLabel *m_labelVertex;
QLineEdit *m_editSizeV;
QLabel *m_labelDEdge;
QLineEdit *m_editSizeDE;
QLabel *m_labelVEdge;
QLineEdit *m_editSizeVE;
QLabel *m_labelFacet;
QSpinBox *m_spinAlphaF;
QLabel *m_labelBall;
QSpinBox *m_spinAlphaB;
QSpinBox *m_spinStep;
QLabel *m_labelSphere;
QSpinBox *m_spinAlphaS;
float m_fSizeVertex;
float m_fSizeDEdge;
float m_fSizeVEdge;
QColor m_colorVertex;
QColor m_colorDEdge;
QColor m_colorVEdge;
QColor m_colorFacet;
QColor m_colorTrackball;
int m_iStep;
QColor m_colorEmptySphere;
};
#endif

View File

@ -0,0 +1,225 @@
#include "Scene.h"
#include <cstring>
#include <iostream>
#include <fstream>
#include <CGAL/IO/File_scanner_OFF.h>
#include <CGAL/IO/File_header_OFF.h>
#include <CGAL/IO/File_writer_OFF.h>
#include <CGAL/IO/read_off_points.h>
#include <CGAL/IO/write_off_points.h>
#include <CGAL/IO/read_xyz_points.h>
#include <CGAL/IO/write_xyz_points.h>
using namespace std;
void Scene::generatePoints(int num)
{
if(num <= 0) return;
/* Generate 'num' points: */
/* 1. randomly in the cube [ (-1,-1,-1), (1,1,1) ] --tested */
CGAL::Random_points_in_cube_3<Point_3> pts_generator(1.0);
/* 2. randomly on a sphere of radius 1.0 --tested */
// CGAL::Random_points_in_sphere_3<Point_3> pts_generator(1.0);
/* Insert them into the point list: */
/* 1. use CGAL's copy function --tested */
list<Point_3> pts;
CGAL::copy_n( pts_generator, num, std::back_inserter(pts) );
/* 2. use STL's function */
//for (int i=0; i<num; ++i, ++pts_generator) {
// pts.push_back(*pts_generator);
//}
/* Insert the points to build a Delaunay triangulation */
/* Note: this function returns the number of inserted points;
it is not guaranteed to insert the points following the order of iteraror. */
m_dt.insert( pts.begin(), pts.end() );
/* Check the combinatorial validity of the triangulation */
/* Note: when it is set to be true,
messages describing the first invalidity encountered are printed. */
if( !m_dt.is_valid() ) // default: false - verbosity off
showError( QObject::tr("Error: fail to build a Delaunay triangulation.") );
/* Check the dimension */
if( m_dt.dimension() != 3 )
showError( QObject::tr("Error: cannot built a 3D triangulation.") );
/* Store the vertex handles into an array for future usage (move, delete, etc) */
for(vertices_iterator vit=m_dt.finite_vertices_begin();
vit!=m_dt.finite_vertices_end(); ++vit) {
m_vhArray.push_back( vit );
}
assert( m_dt.number_of_vertices() == m_vhArray.size() );
}
void Scene::readOFFPointsandFacets(const char* filename,
std::list<Point_3> & points)
{
ifstream fin;
fin.open( filename );
// Check whether the file is opened properly
if( !fin ) {
showError( QObject::tr("Error: cannot open file %1 for reading.").arg(filename) );
return;
}
istream *pIn = &fin;
// Use CGAL::File_scanner_OFF to read in data
CGAL::File_scanner_OFF scanner(*pIn);
if( !(*pIn) ) {
showError( QObject::tr("Input error: file %1 is not in OFF format.").arg(filename) );
return;
}
if( scanner.size_of_vertices() <= 0 ) {
showError( QObject::tr("Input error: file %1 has no vertices.").arg(filename) );
return;
}
// Get points data from scanner
double x, y, z;
for(int i=0; i<scanner.size_of_vertices(); ++i) {
scanner.scan_vertex( x, y, z );
Point_3 pt(x, y, z);
points.push_back(pt);
scanner.skip_to_next_vertex(i);
}//end-for-vertex
}
void Scene::loadPointsOFF(const char* filename)
{
list<Point_3> pts;
/* Read point data from file */
/* 1. use CGAL::File_scanner_OFF to read in data --tested */
readOFFPointsandFacets( filename, pts );
/* 2. use CGAL::read_off_points to read in data -- tested */
/* Note: read in points only, i.e. normals and faces are ignored */
/* Note: this function can NOT omit comments (starting with '#') */
// ifstream fin;
// fin.open( filename );
// check whether the file is opened properly
// if( !fin ) {
// showError( QObject::tr("Error: cannot open file %1 for reading.").arg(filename) );
// return;
// }
// if ( !CGAL::read_off_points( fin, // inout ifstream
// back_inserter(pts) ) ) { // output iterator over points
// showError( QObject::tr("Error: cannot read file %1.").arg(filename) );
// }
/* Insert the points to build a Delaunay triangulation */
/* Note: this function returns the number of inserted points;
it is not guaranteed to insert the points following the order of iteraror. */
m_dt.insert( pts.begin(), pts.end() );
/* Check the combinatorial validity of the triangulation */
/* Note: when it is set to be true,
messages describing the first invalidity encountered are printed. */
if( !m_dt.is_valid() ) // default: false - verbosity off
showError( QObject::tr("Error: fail to build a Delaunay triangulation.") );
/* Check the dimension */
if( m_dt.dimension() != 3 )
showError( QObject::tr("Error: cannot built a 3D triangulation.") );
/* Store the vertex handles into an array for future usage (move, delete, etc) */
for(vertices_iterator vit=m_dt.finite_vertices_begin();
vit!=m_dt.finite_vertices_end(); ++vit) {
m_vhArray.push_back( vit );
}
assert( m_dt.number_of_vertices() == m_vhArray.size() );
}
void Scene::loadPointsXYZ(const char* filename)
{
ifstream fin;
fin.open( filename );
// Check whether the file is opened properly
if( !fin ) {
showError( QObject::tr("Error: cannot open file %1 for reading.").arg(filename) );
return;
}
/* Use CGAL::read_xyz_points to read in data -- tested */
/* Note: this function reads in points only (normals are ignored) */
/* Note: this function can NOT omit comments (starting with '#') */
list<Point_3> pts;
if( !CGAL::read_xyz_points( fin, // input ifstream
back_inserter(pts) ) ) { // output iterator over points
showError( QObject::tr("Error: cannot read file %1.").arg(filename) );
}
/* Insert the points to build a Delaunay triangulation */
/* Note: this function returns the number of inserted points;
it is not guaranteed to insert the points following the order of iteraror. */
m_dt.insert( pts.begin(), pts.end() );
/* Check the combinatorial validity of the triangulation */
/* Note: when it is set to be true,
messages describing the first invalidity encountered are printed. */
if( !m_dt.is_valid() ) // default: false - verbosity off
showError( QObject::tr("Error: fail to build a Delaunay triangulation.") );
/* Check the dimension */
if( m_dt.dimension() != 3 )
showError( QObject::tr("Error: cannot build a 3D triangulation.") );
/* Store the vertex handles into an array for future usage (move, delete, etc) */
for(vertices_iterator vit=m_dt.finite_vertices_begin();
vit!=m_dt.finite_vertices_end(); ++vit) {
m_vhArray.push_back( vit );
}
assert( m_dt.number_of_vertices() == m_vhArray.size() );
}
void Scene::savePointsOFF(const char* filename)
{
ofstream fout;
fout.open( filename );
if( !fout ) {
showError( QObject::tr("Error: cannot open file %1 for writting.").arg(filename) );
return;
}
ostream *pOut = &fout;
/* Use CGAL::File_writer_OFF to write points */
// initialize header_OFF
CGAL::File_header_OFF header(false, // true: binary output; false: ASCII
false, // true: no comments in file
false, // true: Geomview SKEL format
true); // true: verbosity on; false: verbosity off
// a simpler way to initialize header_OFF
// CGAL::File_header_OFF header(true); // true: verbosity on
// // (ASCII output, comments, no SKEL)
CGAL::File_writer_OFF writer( header );
// write header
writer.write_header(*pOut, // output ostream
m_dt.number_of_vertices(), // number of points/vertices
0, // number of halfedges
0, // number of facets
false); // true: has normals
// write points (get from point array)
for(vertices_iterator vit=m_dt.finite_vertices_begin();
vit!=m_dt.finite_vertices_end(); ++vit) {
Point_3& p = vit->point();
writer.write_vertex( p.x(), p.y(), p.z() );
}
// write footer
writer.write_footer();
}
void Scene::savePointsXYZ(const char* filename)
{
ofstream fout;
fout.open( filename );
// Check whether the file is opened properly
if( !fout ) {
showError( QObject::tr("Error: cannot open file %1 for writting.").arg(filename) );
return;
}
/* Use CGAL::write_xyz_points to write out data */
/* Note: this function writes out points only (normals are ignored) */
if( !CGAL::write_xyz_points( fout, // output ofstream
m_dt.points_begin(), // first output point
m_dt.points_end() ) ) { // past-the-end output point
showError( QObject::tr("Error: cannot read file %1.").arg(filename) );
}
}

View File

@ -0,0 +1,40 @@
#ifndef SCENE_H
#define SCENE_H
#include "typedefs.h"
#include <QGLViewer/qglviewer.h>
class Scene {
friend class Viewer;
public:
Scene() {}
~Scene() { eraseOldData(); }
public:
inline void setViewer(QGLViewer* v) { m_viewer = v; }
inline void showError(const QString & msg) {
if(!m_viewer) m_viewer->displayMessage( msg );
}
inline bool isDTEmpty() { return m_dt.number_of_vertices()==0; }
inline void eraseOldData() { m_dt.clear(); m_vhArray.clear(); }
public:
void generatePoints(int);
void loadPointsOFF(const char*);
void loadPointsXYZ(const char*);
void savePointsOFF(const char*);
void savePointsXYZ(const char*);
void readOFFPointsandFacets(const char*, std::list<Point_3> &);
private:
//added for T3 demo
DT3 m_dt;
QList<Vertex_handle> m_vhArray;
QGLViewer* m_viewer;
};
#endif

View File

@ -0,0 +1,37 @@
// Copyright (c) 2010 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you may redistribute it under
// the terms of the Q Public License version 1.0.
// See the file LICENSE.QPL distributed with CGAL.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: svn+ssh://sccode@scm.gforge.inria.fr/svn/cgal/branches/experimental-packages/GSoC10-demoT3/demos/Triangulation_demo_3/ $
// $Id: r58170 2010-08-19 20:46:16 -0400 $
//
//
// Author(s) : Sophie Fei Che <fei@cis.udel.edu>
//
// File Description : Demo of CGAL 3D Triangulation package
#include "MainWindow.h"
#include <QApplication>
int main(int argc, char** argv)
{
QApplication app(argc, argv);
app.setOrganizationDomain("inria.fr");
app.setOrganizationName("INRIA");
app.setApplicationName("3D Triangulation Demo");
MainWindow mw;
mw.show();
return app.exec();
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,290 @@
#ifndef VIEWER_H
#define VIEWER_H
#include "Scene.h"
#include <QGLViewer/qglviewer.h>
#include <QMouseEvent>
#include <QKeyEvent>
#include <QSettings>
#include "PreferenceDlg.h"
#include <iostream>
using namespace qglviewer;
class MainWindow;
class Viewer : public QGLViewer {
Q_OBJECT
public:
Viewer(QWidget* parent)
: QGLViewer(parent)
, m_showAxis(false)
, m_showVertex(true)
, m_showDEdge(true)
, m_showVEdge(false)
, m_showFacet(false)
, m_isFlat(false)
, m_fRadius(1.)
, m_curMode(NONE)
, m_selMode(NORMAL)
, m_isPress(false)
, m_isMoving(false)
, m_hasNewPt(false)
, m_nearestNb(NULL)
, m_hasEmptyS(false)
, m_showTrackball(true)
, m_pDlgPrefer(NULL)
{}
enum Mode { NONE, INSERT_V, INSERT_PT, MOVE, SELECT, FINDNB, EMPTYSPH };
public:
inline void setScene(Scene* pScene) { m_pScene = pScene; }
// set current mode
inline void setMode(Mode m) {
m_curMode = m;
m_isMoving = false;
m_hasEmptyS = false;
m_nearestNb = NULL;
updateGL();
}
// set selectBuffer size (if necessary)
inline void setSelBuffSize() {
// Default selectBuffer size is 4000
// (i.e. 1000 objects in selection region, since each object pushes 4 values).
if( m_pScene->m_vhArray.size() > 900 )
// The previous selectBuffer is deleted and a new one is created.
setSelectBufferSize( 4*(m_pScene->m_vhArray.size() + 100) );
}
void readSettings() {
// read from an .ini file
QSettings settings("settings.ini", QSettings::IniFormat);
// QVariant value ( const QString & key, const QVariant & defaultValue = QVariant() )
// Because QVariant is part of the QtCore library,
// it cannot provide conversion functions to data types such as QColor and QImage,
// which are part of QtGui.
// In other words, there is no toColor(), toImage(), or toPixmap() functions in QVariant.
// Instead, use the QVariant::value() or the qVariantValue() template function
m_colorVertex = settings.value( "Show/vertexcolor", QColor(255, 150, 0) ).value<QColor>();
#if QT_VERSION >= 0x040600
m_fSizeVertex = settings.value( "Show/vertexsize", 0.04f ).toFloat();
#else
m_fSizeVertex = settings.value( "Show/vertexsize", 0.04f ).value<float>();
#endif
m_colorDEdge = settings.value( "Show/dedgecolor", QColor(0, 255, 0) ).value<QColor>();
#if QT_VERSION >= 0x040600
m_fSizeDEdge = settings.value( "Show/dedgesize", 0.01f ).toFloat();
#else
m_fSizeDEdge = settings.value( "Show/dedgesize", 0.01f ).value<float>();
#endif
m_colorVEdge = settings.value( "Show/vedgecolor", QColor(0, 0, 255) ).value<QColor>();
#if QT_VERSION >= 0x040600
m_fSizeVEdge = settings.value( "Show/vedgesize", 0.01f ).toFloat();
#else
m_fSizeVEdge = settings.value( "Show/vedgesize", 0.01f ).value<float>();
#endif
m_colorFacet = settings.value( "Show/facetcolor",
QColor(255, 255, 0, 96) ).value<QColor>();
m_colorTrackball = settings.value( "Show/ballcolor",
QColor(150, 150, 150, 128) ).value<QColor>();
m_iStep = settings.value( "Show/ballstep", 4000 ).toInt();
m_colorEmptySphere = settings.value( "Show/spherecolor",
QColor(180, 50, 180, 64) ).value<QColor>();
}
void writeSettings() {
// write to an .ini file
QSettings settings("settings.ini", QSettings::IniFormat);
// The inverse conversion (e.g., from QColor to QVariant) is automatic
// for all data types supported by QVariant, including GUI-related types
settings.setValue("Show/vertexcolor", m_colorVertex);
settings.setValue("Show/vertexsize", m_fSizeVertex);
settings.setValue("Show/dedgecolor", m_colorDEdge);
settings.setValue("Show/dedgesize", m_fSizeDEdge);
settings.setValue("Show/vedgecolor", m_colorVEdge);
settings.setValue("Show/vedgesize", m_fSizeVEdge);
settings.setValue("Show/facetcolor", m_colorFacet);
settings.setValue("Show/ballcolor", m_colorTrackball);
settings.setValue("Show/ballstep", m_iStep);
settings.setValue("Show/spherecolor", m_colorEmptySphere);
}
public slots :
// clear scene
void clear() {
m_pScene->eraseOldData();
m_hasNewPt = false;
m_boundaryFacets.clear();
m_conflictCells.clear();
m_vidSeled.clear();
m_isMoving = false;
m_nearestNb = NULL;
m_hasEmptyS = false;
if( !m_incrementalPts.isEmpty() ) {
emit( stopIncAnimation() );
m_incrementalPts.clear();
}
}
// play/pause incremental construction
void toggleIncremental(bool on);
// clean up old data and information
void initClean() {
m_pScene->eraseOldData();
m_hasNewPt = false;
m_boundaryFacets.clear();
m_conflictCells.clear();
m_vidSeled.clear();
m_isMoving = false;
m_nearestNb = NULL;
m_hasEmptyS = false;
}
// stop incremental construction
void stopIncremental();
// incremental insert a vertex (invoked by Timer)
void incremental_insert();
// show options
inline void toggleShowAxis(bool flag) { m_showAxis = flag; updateGL(); }
inline void toggleShowVertex(bool flag) { m_showVertex = flag; updateGL(); }
inline void toggleShowDEdge(bool flag) { m_showDEdge = flag; updateGL(); }
inline void toggleShowVEdge(bool flag) { m_showVEdge = flag; updateGL(); }
inline void toggleShowFacet(bool flag) { m_showFacet = flag; updateGL(); }
inline void toggleFlat(bool flag) { m_isFlat = flag; updateGL(); }
// set preferences
void setPreferences() {
if (!m_pDlgPrefer) {
m_pDlgPrefer = new PreferenceDlg(this);
m_pDlgPrefer->init( m_colorVertex, m_fSizeVertex, m_colorDEdge, m_fSizeDEdge, m_colorVEdge, m_fSizeVEdge,
m_colorFacet, m_colorTrackball, m_colorEmptySphere, m_iStep/40 ); // 5*8, 5 degrees of wheel
connect(m_pDlgPrefer, SIGNAL(applyChanges()), this, SLOT(acceptChanges()) );
}
m_pDlgPrefer->show();
m_pDlgPrefer->raise();
m_pDlgPrefer->activateWindow();
}
void acceptChanges() {
m_colorVertex = m_pDlgPrefer->m_colorVertex;
m_fSizeVertex = m_pDlgPrefer->m_fSizeVertex;
m_colorDEdge = m_pDlgPrefer->m_colorDEdge;
m_fSizeDEdge = m_pDlgPrefer->m_fSizeDEdge;
m_colorVEdge = m_pDlgPrefer->m_colorVEdge;
m_fSizeVEdge = m_pDlgPrefer->m_fSizeVEdge;
m_colorFacet = m_pDlgPrefer->m_colorFacet;
m_colorTrackball = m_pDlgPrefer->m_colorTrackball;
m_iStep = m_pDlgPrefer->m_iStep*40;
m_colorEmptySphere = m_pDlgPrefer->m_colorEmptySphere;
// redraw
updateGL();
}
signals:
void stopIncAnimation();
// overloading QGLViewer virtual functions
protected:
// initialize Viewer OpenGL context
// Note: the default implement is empty and this is overloading.
void init();
// draw points, segments, and polygons
void draw();
// customize selection process
void drawWithNames();
void endSelection(const QPoint& point);
// customize mouse events
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
// customize key events
void keyPressEvent(QKeyEvent *event);
// customize help message
QString helpString() const;
private:
// draw a 3d effect vertex
void drawVertex(const Point_3& p, const QColor& clr, float r);
// draw a 3d effect edge
void drawEdge(const Point_3& from, const Point_3& to, const QColor& clr, float r);
// draw a facet
void drawFacet(const Triangle_3& t, const QColor& clr);
// draw a sphere with/without Axis
void drawSphere(float r, const QColor& clr, const Point_3& center=CGAL::ORIGIN);
// test whether the give 3D point is on the sphere
inline bool isOnSphere( const Point_3 & pt ) {
return ( (pt.x()*pt.x() + pt.y()*pt.y() + pt.z()*pt.z()) == (m_fRadius*m_fRadius) );
}
// compute the intersection point with the sphere
bool computeIntersect( const QPoint & pos, Vec & pt );
// compute the conflict region
void computeConflict( Point_3 pt );
private:
Scene* m_pScene;
// play timer
QTimer* m_pTimer;
Point_3 m_curIncPt;
QList<Point_3> m_incrementalPts;
enum Step { INIT, NEWPT, CELL, CONFLICT };
Step m_curStep;
Cell_handle m_cellContain;
QList<Facet> m_boundaryFacets;
QList<Cell_handle> m_conflictCells;
// show options
bool m_showAxis;
bool m_showVertex;
bool m_showDEdge;
bool m_showVEdge;
bool m_showFacet;
bool m_isFlat;
// trackball
float m_fRadius;
// mode
Mode m_curMode;
bool m_isPress;
bool m_isMoving;
// insert point
bool m_hasNewPt;
Point_3 m_newPt;
// select vertex
enum selectionMode { NORMAL, ADD };
selectionMode m_selMode;
QRect m_rectSel;
QList<int> m_vidSeled;
// move vertex/point
int m_vidMoving;
// nearest neighbor
Point_3 m_queryPt;
Vertex_handle m_nearestNb;
// empty sphere
bool m_hasEmptyS;
bool m_showTrackball;
Point_3 m_centerPt;
float m_fREmptyS;
// change colors
PreferenceDlg* m_pDlgPrefer;
float m_fSizeVertex;
float m_fSizeDEdge;
float m_fSizeVEdge;
QColor m_colorVertex;
QColor m_colorDEdge;
QColor m_colorVEdge;
QColor m_colorFacet;
QColor m_colorTrackball;
QColor m_colorEmptySphere;
// trackball resizing fineness
int m_iStep;
};
#endif

View File

@ -0,0 +1,13 @@
<html>
<body>
<h2>CGAL Triangulation_3 Demo</h2>
<p>Copyright &copy;2010-2011<br>
<a href="http://www-sop.inria.fr/">INRIA Sophia Antipolis - Mediterranee<a/></p>
<p>This application illustrates an interactive demo for 3D Delaunay Triangulation package
of <a href="http://www.cgal.org/">CGAL</a>.</p>
<p>See also the package manual:<br>
<a href="http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_3/Chapter_main.html">
3D Triangulations</a>
</p>
</body>
</html>

View File

@ -0,0 +1,7 @@
<html>
<body>
<h2>Computational Geometry Algorithms Library</h2>
<p>CGAL provides efficient and reliable geometric algorithms in the form of a C++ library.</p>
<p>For more information visit <a href="http://www.cgal.org/">www.cgal.org</a>.</p>
</body>
</html>

View File

@ -0,0 +1,8 @@
<html>
<body>
<p><img src=":/cgal/logos/CGAL.gif"></p>
<h2>Computational Geometry Algorithms Library<!--CGAL_VERSION--></h2>
<p>CGAL provides efficient and reliable geometric algorithms in the form of a C++ library.</p>
<p>For more information visit <a href="http://www.cgal.org/">www.cgal.org</a></p>
</body>
</html>

View File

@ -0,0 +1,24 @@
/* XPM */
const char * demoicon_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c None",
". c #FFFF00",
"+ c #000000",
/* pixels */
"................",
"...++++...++++..",
"..+....+.+....+.",
"..+......+......",
"..+......+..+++.",
"..+......+....+.",
"..+....+.+....+.",
"...++++...++++..",
"................",
"...++++...+.....",
"..+....+..+.....",
"..+....+..+.....",
"..++++++..+.....",
"..+....+..+.....",
"..+....+..+++++.",
"................"};

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 797 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1017 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1003 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 B

View File

@ -0,0 +1,101 @@
#ifndef TYPEDEFS_H
#define TYPEDEFS_H
#include <vector> //dynamic array
#include <list> //linked list
// CGAL
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/point_generators_3.h>
// Added for T3 demo
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_vertex_base_3.h>
// Use EPEC as Kernel
// Note: the computation of VD requires exact constructions;
// while computing the triangulation only requires exact predicates.
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
// Ddefine field type
typedef Kernel::FT FT;
typedef Kernel::Vector_3 Vector_3;
typedef Kernel::Direction_3 Direction_3;
//typedef Kernel::Point_3 Point_3;
//typedef Kernel::Vector_3 Vector_3;
//typedef Kernel::Segment_3 Segment_3;
//typedef Kernel::Triangle_3 Triangle_3;
// Added for T3 demo
/*
* The user has several ways to add his own data in the vertex
* and cell base classes used by the TDS. He can either: * 1. use the classes Triangulation vertex base with info
* and Triangulation cell base with info, which allow to
* add one data member of a user provided type, and give access to it. * 2. derive his own classes from the default base classes
* Triangulation ds vertex base, and Triangulation ds cell base
* (or the geometric versions typically used by the geometric layer,
* Triangulation vertex base, and Triangulation cell base). * 3. write his own base classes following the requirements given by the concepts
* TriangulationCellBase 3 and TriangulationVertexBase 3
* (described in page 2494 and page 2495).
*/
/* add index and color to vertex class */
template < class GT, class Vb=CGAL::Triangulation_vertex_base_3<GT> >
class Vertex_base : public Vb
{
public:
typedef typename Vb::Point Point;
typedef typename Vb::Vertex_handle Vertex_handle;
typedef typename Vb::Cell_handle Cell_handle;
template < class TDS2 >
struct Rebind_TDS {
typedef typename Vb::template Rebind_TDS<TDS2>::Other Vb2;
typedef Vertex_base< GT, Vb2 > Other;
};
Vertex_base()
: m_isSelected(false) {}
Vertex_base(const Point& p)
: Vb(p), m_isSelected(false) {}
Vertex_base(const Point& p, Cell_handle c)
: Vb(p, c), m_isSelected(false) {}
inline bool isSeled() const { return m_isSelected; }
inline void setSeled(bool flag=true) { m_isSelected = flag; }
private:
bool m_isSelected; // whether it is selected
};
typedef CGAL::Triangulation_data_structure_3< Vertex_base<Kernel> > Tds;
/*
* Delaunay_triangulation_3<arg1, arg2, arg3>
* arg1: a model of the DelaunayTriangulationTraits_3 concept
* arg2: a model of the TriangulationDataStructure_3 concept
* default: Triangulation_data_structure_3
* arg3: Fast_location or Compact_location (default)
* Fast_location offers O(logn) time point location, using additional data structure,
* good for fast point locations or random point insertions
* Compact_location saves memory by avoiding the separate data structure
* and point location is then O(n^(1/3)) time
*/
typedef CGAL::Delaunay_triangulation_3<Kernel, Tds, CGAL::Fast_location> DT3;
typedef DT3::Object Object_3;
typedef DT3::Point Point_3;
typedef DT3::Segment Segment_3;
typedef DT3::Ray Ray_3;
typedef DT3::Triangle Triangle_3;
typedef DT3::Vertex_handle Vertex_handle;
typedef DT3::Finite_vertices_iterator vertices_iterator;
typedef DT3::Edge Edge;
typedef DT3::Finite_edges_iterator edges_iterator;
typedef DT3::Facet Facet;
typedef DT3::Finite_facets_iterator facets_iterator;
typedef DT3::Cell_handle Cell_handle;
typedef DT3::Finite_cells_iterator cells_iterator;
#endif

View File

@ -0,0 +1,584 @@
/********************************************************************************
** Form generated from reading ui file 'MainWindow.ui'
**
** Created: Mon Dec 20 14:14:32 2010
** by: Qt User Interface Compiler version 4.4.1
**
** WARNING! All changes made in this file will be lost when recompiling ui file!
********************************************************************************/
#ifndef UI_MAINWINDOW_H
#define UI_MAINWINDOW_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QHBoxLayout>
#include <QtGui/QMainWindow>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QStatusBar>
#include <QtGui/QToolBar>
#include <QtGui/QWidget>
#include "Viewer.h"
QT_BEGIN_NAMESPACE
class Ui_MainWindow
{
public:
QAction *actionGenerate_Points;
QAction *actionLoad_Points;
QAction *actionSave_Points;
QAction *actionShow_Axis;
QAction *actionQuit;
QAction *actionClear_Scene;
QAction *actionShow_Vertex;
QAction *actionShow_DEdge;
QAction *actionShow_VEdge;
QAction *actionShow_Facet;
QAction *actionFlat;
QAction *actionPreferences;
QAction *actionInsert_Vertex;
QAction *actionInsert_Point;
QAction *actionSelect_Vertex;
QAction *actionMove_Vertex;
QAction *actionFind_NearestNb;
QAction *actionEmpty_Sphere;
QAction *actionNormal_View;
QAction *actionDemo_Help;
QAction *actionIncremental_Construct;
QAction *actionStop_Animation;
QAction *actionAbout_T3_demo;
QWidget *centralwidget;
QHBoxLayout *horizontalLayout;
Viewer *viewer;
QMenuBar *menubar;
QMenu *menuFile;
QMenu *menuEdit;
QMenu *menuMode;
QMenu *menuShow;
QMenu *menuHelp;
QStatusBar *statusbar;
QToolBar *toolBar;
void setupUi(QMainWindow *MainWindow)
{
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
MainWindow->setWindowModality(Qt::NonModal);
MainWindow->resize(1100, 500);
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(MainWindow->sizePolicy().hasHeightForWidth());
MainWindow->setSizePolicy(sizePolicy);
QFont font;
font.setFamily(QString::fromUtf8("Arial"));
MainWindow->setFont(font);
MainWindow->setCursor(QCursor(Qt::PointingHandCursor));
QIcon icon;
icon.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/cgal_logo.xpm")), QIcon::Normal, QIcon::Off);
MainWindow->setWindowIcon(icon);
actionGenerate_Points = new QAction(MainWindow);
actionGenerate_Points->setObjectName(QString::fromUtf8("actionGenerate_Points"));
QIcon icon1;
icon1.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/pointRandom.png")), QIcon::Normal, QIcon::Off);
actionGenerate_Points->setIcon(icon1);
actionLoad_Points = new QAction(MainWindow);
actionLoad_Points->setObjectName(QString::fromUtf8("actionLoad_Points"));
QIcon icon2;
icon2.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/fileOpen.png")), QIcon::Normal, QIcon::Off);
actionLoad_Points->setIcon(icon2);
actionSave_Points = new QAction(MainWindow);
actionSave_Points->setObjectName(QString::fromUtf8("actionSave_Points"));
QIcon icon3;
icon3.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/fileSave.png")), QIcon::Normal, QIcon::Off);
actionSave_Points->setIcon(icon3);
actionShow_Axis = new QAction(MainWindow);
actionShow_Axis->setObjectName(QString::fromUtf8("actionShow_Axis"));
actionShow_Axis->setCheckable(true);
QIcon icon4;
icon4.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/coordinates.jpeg")), QIcon::Normal, QIcon::Off);
actionShow_Axis->setIcon(icon4);
actionQuit = new QAction(MainWindow);
actionQuit->setObjectName(QString::fromUtf8("actionQuit"));
QIcon icon5;
icon5.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/quit.jpeg")), QIcon::Normal, QIcon::Off);
actionQuit->setIcon(icon5);
actionClear_Scene = new QAction(MainWindow);
actionClear_Scene->setObjectName(QString::fromUtf8("actionClear_Scene"));
QIcon icon6;
icon6.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/clear.jpeg")), QIcon::Normal, QIcon::Off);
actionClear_Scene->setIcon(icon6);
actionShow_Vertex = new QAction(MainWindow);
actionShow_Vertex->setObjectName(QString::fromUtf8("actionShow_Vertex"));
actionShow_Vertex->setCheckable(true);
actionShow_Vertex->setChecked(true);
QIcon icon7;
icon7.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/show_point.jpeg")), QIcon::Normal, QIcon::Off);
actionShow_Vertex->setIcon(icon7);
actionShow_DEdge = new QAction(MainWindow);
actionShow_DEdge->setObjectName(QString::fromUtf8("actionShow_DEdge"));
actionShow_DEdge->setCheckable(true);
actionShow_DEdge->setChecked(true);
QIcon icon8;
icon8.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/show_delaunay.jpeg")), QIcon::Normal, QIcon::Off);
actionShow_DEdge->setIcon(icon8);
actionShow_VEdge = new QAction(MainWindow);
actionShow_VEdge->setObjectName(QString::fromUtf8("actionShow_VEdge"));
actionShow_VEdge->setCheckable(true);
QIcon icon9;
icon9.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/show_voronoi.jpeg")), QIcon::Normal, QIcon::Off);
actionShow_VEdge->setIcon(icon9);
actionShow_Facet = new QAction(MainWindow);
actionShow_Facet->setObjectName(QString::fromUtf8("actionShow_Facet"));
actionShow_Facet->setCheckable(true);
QIcon icon10;
icon10.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/show_facet.jpeg")), QIcon::Normal, QIcon::Off);
actionShow_Facet->setIcon(icon10);
actionFlat = new QAction(MainWindow);
actionFlat->setObjectName(QString::fromUtf8("actionFlat"));
actionFlat->setCheckable(true);
QIcon icon11;
icon11.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/flat.png")), QIcon::Normal, QIcon::Off);
icon11.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/stereo.png")), QIcon::Normal, QIcon::On);
actionFlat->setIcon(icon11);
actionPreferences = new QAction(MainWindow);
actionPreferences->setObjectName(QString::fromUtf8("actionPreferences"));
QIcon icon12;
icon12.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/preferences.jpeg")), QIcon::Normal, QIcon::Off);
actionPreferences->setIcon(icon12);
actionInsert_Vertex = new QAction(MainWindow);
actionInsert_Vertex->setObjectName(QString::fromUtf8("actionInsert_Vertex"));
actionInsert_Vertex->setCheckable(true);
QIcon icon13;
icon13.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/insert.jpeg")), QIcon::Normal, QIcon::Off);
actionInsert_Vertex->setIcon(icon13);
actionInsert_Point = new QAction(MainWindow);
actionInsert_Point->setObjectName(QString::fromUtf8("actionInsert_Point"));
actionInsert_Point->setCheckable(true);
QIcon icon14;
icon14.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/insert_point.jpg")), QIcon::Normal, QIcon::Off);
actionInsert_Point->setIcon(icon14);
actionSelect_Vertex = new QAction(MainWindow);
actionSelect_Vertex->setObjectName(QString::fromUtf8("actionSelect_Vertex"));
actionSelect_Vertex->setCheckable(true);
QIcon icon15;
icon15.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/select_hand.jpeg")), QIcon::Normal, QIcon::Off);
actionSelect_Vertex->setIcon(icon15);
actionMove_Vertex = new QAction(MainWindow);
actionMove_Vertex->setObjectName(QString::fromUtf8("actionMove_Vertex"));
actionMove_Vertex->setCheckable(true);
QIcon icon16;
icon16.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/move_1.jpeg")), QIcon::Normal, QIcon::Off);
actionMove_Vertex->setIcon(icon16);
actionFind_NearestNb = new QAction(MainWindow);
actionFind_NearestNb->setObjectName(QString::fromUtf8("actionFind_NearestNb"));
actionFind_NearestNb->setCheckable(true);
QIcon icon17;
icon17.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/nearest_nb.png")), QIcon::Normal, QIcon::Off);
actionFind_NearestNb->setIcon(icon17);
actionEmpty_Sphere = new QAction(MainWindow);
actionEmpty_Sphere->setObjectName(QString::fromUtf8("actionEmpty_Sphere"));
actionEmpty_Sphere->setCheckable(true);
QIcon icon18;
icon18.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/empty_sphere.jpeg")), QIcon::Normal, QIcon::Off);
actionEmpty_Sphere->setIcon(icon18);
actionNormal_View = new QAction(MainWindow);
actionNormal_View->setObjectName(QString::fromUtf8("actionNormal_View"));
actionNormal_View->setCheckable(true);
actionNormal_View->setChecked(true);
QIcon icon19;
icon19.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/normal_view.jpeg")), QIcon::Normal, QIcon::Off);
actionNormal_View->setIcon(icon19);
actionDemo_Help = new QAction(MainWindow);
actionDemo_Help->setObjectName(QString::fromUtf8("actionDemo_Help"));
actionIncremental_Construct = new QAction(MainWindow);
actionIncremental_Construct->setObjectName(QString::fromUtf8("actionIncremental_Construct"));
actionIncremental_Construct->setCheckable(true);
QIcon icon20;
icon20.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/play.jpeg")), QIcon::Normal, QIcon::Off);
icon20.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/pause.jpeg")), QIcon::Normal, QIcon::On);
actionIncremental_Construct->setIcon(icon20);
actionStop_Animation = new QAction(MainWindow);
actionStop_Animation->setObjectName(QString::fromUtf8("actionStop_Animation"));
QIcon icon21;
icon21.addPixmap(QPixmap(QString::fromUtf8(":/T3_demo/icons/icons/stop.jpeg")), QIcon::Normal, QIcon::Off);
actionStop_Animation->setIcon(icon21);
actionAbout_T3_demo = new QAction(MainWindow);
actionAbout_T3_demo->setObjectName(QString::fromUtf8("actionAbout_T3_demo"));
centralwidget = new QWidget(MainWindow);
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
horizontalLayout = new QHBoxLayout(centralwidget);
horizontalLayout->setSpacing(3);
horizontalLayout->setMargin(1);
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
viewer = new Viewer(centralwidget);
viewer->setObjectName(QString::fromUtf8("viewer"));
sizePolicy.setHeightForWidth(viewer->sizePolicy().hasHeightForWidth());
viewer->setSizePolicy(sizePolicy);
viewer->setCursor(QCursor(Qt::PointingHandCursor));
horizontalLayout->addWidget(viewer);
MainWindow->setCentralWidget(centralwidget);
menubar = new QMenuBar(MainWindow);
menubar->setObjectName(QString::fromUtf8("menubar"));
menubar->setGeometry(QRect(0, 0, 1010, 22));
menuFile = new QMenu(menubar);
menuFile->setObjectName(QString::fromUtf8("menuFile"));
menuEdit = new QMenu(menubar);
menuEdit->setObjectName(QString::fromUtf8("menuEdit"));
menuMode = new QMenu(menubar);
menuMode->setObjectName(QString::fromUtf8("menuMode"));
menuShow = new QMenu(menubar);
menuShow->setObjectName(QString::fromUtf8("menuShow"));
menuHelp = new QMenu(menubar);
menuHelp->setObjectName(QString::fromUtf8("menuHelp"));
MainWindow->setMenuBar(menubar);
statusbar = new QStatusBar(MainWindow);
statusbar->setObjectName(QString::fromUtf8("statusbar"));
MainWindow->setStatusBar(statusbar);
toolBar = new QToolBar(MainWindow);
toolBar->setObjectName(QString::fromUtf8("toolBar"));
MainWindow->addToolBar(Qt::TopToolBarArea, toolBar);
menubar->addAction(menuFile->menuAction());
menubar->addAction(menuEdit->menuAction());
menubar->addAction(menuMode->menuAction());
menubar->addAction(menuShow->menuAction());
menubar->addAction(menuHelp->menuAction());
menuFile->addAction(actionLoad_Points);
menuFile->addAction(actionSave_Points);
menuFile->addSeparator();
menuFile->addAction(actionQuit);
menuEdit->addAction(actionGenerate_Points);
menuEdit->addSeparator();
menuEdit->addAction(actionIncremental_Construct);
menuEdit->addAction(actionStop_Animation);
menuEdit->addSeparator();
menuEdit->addAction(actionClear_Scene);
menuMode->addAction(actionNormal_View);
menuMode->addAction(actionInsert_Vertex);
menuMode->addAction(actionInsert_Point);
menuMode->addAction(actionSelect_Vertex);
menuMode->addAction(actionMove_Vertex);
menuMode->addAction(actionFind_NearestNb);
menuMode->addAction(actionEmpty_Sphere);
menuShow->addAction(actionShow_Axis);
menuShow->addSeparator();
menuShow->addAction(actionShow_Vertex);
menuShow->addAction(actionShow_DEdge);
menuShow->addAction(actionShow_VEdge);
menuShow->addAction(actionShow_Facet);
menuShow->addSeparator();
menuShow->addAction(actionFlat);
menuShow->addSeparator();
menuShow->addAction(actionPreferences);
menuHelp->addAction(actionDemo_Help);
menuHelp->addAction(actionAbout_T3_demo);
toolBar->addAction(actionLoad_Points);
toolBar->addAction(actionSave_Points);
toolBar->addSeparator();
toolBar->addAction(actionGenerate_Points);
toolBar->addAction(actionClear_Scene);
toolBar->addSeparator();
toolBar->addAction(actionIncremental_Construct);
toolBar->addAction(actionStop_Animation);
toolBar->addSeparator();
toolBar->addAction(actionShow_Axis);
toolBar->addSeparator();
toolBar->addAction(actionFlat);
toolBar->addSeparator();
toolBar->addAction(actionShow_Vertex);
toolBar->addAction(actionShow_DEdge);
toolBar->addAction(actionShow_VEdge);
toolBar->addAction(actionShow_Facet);
toolBar->addSeparator();
toolBar->addAction(actionNormal_View);
toolBar->addAction(actionInsert_Vertex);
toolBar->addAction(actionInsert_Point);
toolBar->addAction(actionSelect_Vertex);
toolBar->addAction(actionMove_Vertex);
toolBar->addAction(actionFind_NearestNb);
toolBar->addAction(actionEmpty_Sphere);
toolBar->addSeparator();
toolBar->addAction(actionPreferences);
toolBar->addSeparator();
toolBar->addAction(actionQuit);
retranslateUi(MainWindow);
QMetaObject::connectSlotsByName(MainWindow);
} // setupUi
void retranslateUi(QMainWindow *MainWindow)
{
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "Triangulation_demo_3", 0, QApplication::UnicodeUTF8));
actionGenerate_Points->setText(QApplication::translate("MainWindow", "Generate Points", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionGenerate_Points->setToolTip(QApplication::translate("MainWindow", "Generate Points", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionGenerate_Points->setStatusTip(QApplication::translate("MainWindow", "Generate Points", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionGenerate_Points->setShortcut(QApplication::translate("MainWindow", "Ctrl+G", 0, QApplication::UnicodeUTF8));
actionLoad_Points->setText(QApplication::translate("MainWindow", "Load Points...", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionLoad_Points->setToolTip(QApplication::translate("MainWindow", "Load Points from a file", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionLoad_Points->setStatusTip(QApplication::translate("MainWindow", "Load Points from a file", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionLoad_Points->setShortcut(QApplication::translate("MainWindow", "Ctrl+O", 0, QApplication::UnicodeUTF8));
actionSave_Points->setText(QApplication::translate("MainWindow", "Save Points...", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionSave_Points->setToolTip(QApplication::translate("MainWindow", "Save points to a file", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionSave_Points->setStatusTip(QApplication::translate("MainWindow", "Save points to a file", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionSave_Points->setShortcut(QApplication::translate("MainWindow", "Ctrl+S", 0, QApplication::UnicodeUTF8));
actionShow_Axis->setText(QApplication::translate("MainWindow", "Show Axis", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionShow_Axis->setToolTip(QApplication::translate("MainWindow", "Show/Hide Axis", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionShow_Axis->setStatusTip(QApplication::translate("MainWindow", "Show/Hide Axis", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionQuit->setText(QApplication::translate("MainWindow", "Quit", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionQuit->setToolTip(QApplication::translate("MainWindow", "Quit", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionQuit->setStatusTip(QApplication::translate("MainWindow", "Quit", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionClear_Scene->setText(QApplication::translate("MainWindow", "Clear Scene", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionClear_Scene->setToolTip(QApplication::translate("MainWindow", "Clear Scene", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionClear_Scene->setStatusTip(QApplication::translate("MainWindow", "Clear Scene", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionShow_Vertex->setText(QApplication::translate("MainWindow", "Show Vertices", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionShow_Vertex->setToolTip(QApplication::translate("MainWindow", "Show Vertices", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionShow_Vertex->setStatusTip(QApplication::translate("MainWindow", "Show Vertices", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionShow_DEdge->setText(QApplication::translate("MainWindow", "Show Delaunay Edges", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionShow_DEdge->setToolTip(QApplication::translate("MainWindow", "Show Delaunay edges", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionShow_DEdge->setStatusTip(QApplication::translate("MainWindow", "Show Delaunay edges", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionShow_VEdge->setText(QApplication::translate("MainWindow", "Show Voronoi Edges", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionShow_VEdge->setToolTip(QApplication::translate("MainWindow", "Show Voronoi edges", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionShow_VEdge->setStatusTip(QApplication::translate("MainWindow", "Show Voronoi edges", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionShow_Facet->setText(QApplication::translate("MainWindow", "Show Facets", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionShow_Facet->setToolTip(QApplication::translate("MainWindow", "Show Delaunay Facets", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionShow_Facet->setStatusTip(QApplication::translate("MainWindow", "Show Delaunay Facets", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionFlat->setText(QApplication::translate("MainWindow", "Flat", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionFlat->setToolTip(QApplication::translate("MainWindow", "Toggle 3D effect", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionFlat->setStatusTip(QApplication::translate("MainWindow", "Toggle 3D effect", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionPreferences->setText(QApplication::translate("MainWindow", "Preferences...", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionPreferences->setToolTip(QApplication::translate("MainWindow", "Change Colors, Transparency, etc.", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionPreferences->setStatusTip(QApplication::translate("MainWindow", "Change Colors, Transparency, etc.", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionInsert_Vertex->setText(QApplication::translate("MainWindow", "Insert Vertex", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionInsert_Vertex->setToolTip(QApplication::translate("MainWindow", "Insert a vertex and update the triangulation", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionInsert_Vertex->setStatusTip(QApplication::translate("MainWindow", "Insert a vertex and update the triangulation", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionInsert_Point->setText(QApplication::translate("MainWindow", "Insert Point", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionInsert_Point->setToolTip(QApplication::translate("MainWindow", "Insert a point and show its conflict region", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionInsert_Point->setStatusTip(QApplication::translate("MainWindow", "Insert a point and show its conflict region", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionSelect_Vertex->setText(QApplication::translate("MainWindow", "Select Vertex", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionSelect_Vertex->setToolTip(QApplication::translate("MainWindow", "Select vertices", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionSelect_Vertex->setStatusTip(QApplication::translate("MainWindow", "Select vertices", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionMove_Vertex->setText(QApplication::translate("MainWindow", "Move Vertex", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionMove_Vertex->setToolTip(QApplication::translate("MainWindow", "Move a vertex", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionMove_Vertex->setStatusTip(QApplication::translate("MainWindow", "Move a vertex", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionFind_NearestNb->setText(QApplication::translate("MainWindow", "Nearest Neighbor Search", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionFind_NearestNb->setToolTip(QApplication::translate("MainWindow", "Find the nearest neighbor of the query point", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionFind_NearestNb->setStatusTip(QApplication::translate("MainWindow", "Find the nearest neighbor of the query point", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionEmpty_Sphere->setText(QApplication::translate("MainWindow", "Show Empty Sphere", 0, QApplication::UnicodeUTF8));
actionEmpty_Sphere->setIconText(QApplication::translate("MainWindow", "Click to select a cell and show empty sphere of that cell.", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionEmpty_Sphere->setToolTip(QApplication::translate("MainWindow", "Locate the query point in a cell and show empty sphere of that cell", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionEmpty_Sphere->setStatusTip(QApplication::translate("MainWindow", "Locate the query point in a cell and show empty sphere of that cell", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionNormal_View->setText(QApplication::translate("MainWindow", "Normal Mode", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionNormal_View->setToolTip(QApplication::translate("MainWindow", "Normal Mode", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionNormal_View->setStatusTip(QApplication::translate("MainWindow", "Normal Mode", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionDemo_Help->setText(QApplication::translate("MainWindow", "Triangulation_3D Demo Help", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionDemo_Help->setToolTip(QApplication::translate("MainWindow", "Triangulation_3D Demo Help", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionDemo_Help->setStatusTip(QApplication::translate("MainWindow", "Triangulation_3D Demo Help", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionDemo_Help->setShortcut(QApplication::translate("MainWindow", "H", 0, QApplication::UnicodeUTF8));
actionIncremental_Construct->setText(QApplication::translate("MainWindow", "Insertion Animation", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionIncremental_Construct->setToolTip(QApplication::translate("MainWindow", "Animation of incremental Delaunay triangulation", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionIncremental_Construct->setStatusTip(QApplication::translate("MainWindow", "Animation of incremental Delaunay triangulation", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionStop_Animation->setText(QApplication::translate("MainWindow", "Stop Animation", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
actionStop_Animation->setToolTip(QApplication::translate("MainWindow", "Stop Animation", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
actionStop_Animation->setStatusTip(QApplication::translate("MainWindow", "Stop Animation", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_STATUSTIP
actionAbout_T3_demo->setText(QApplication::translate("MainWindow", "About T3_demo", 0, QApplication::UnicodeUTF8));
menuFile->setTitle(QApplication::translate("MainWindow", "&File", 0, QApplication::UnicodeUTF8));
menuEdit->setTitle(QApplication::translate("MainWindow", "Edit", 0, QApplication::UnicodeUTF8));
menuMode->setTitle(QApplication::translate("MainWindow", "Mode", 0, QApplication::UnicodeUTF8));
menuShow->setTitle(QApplication::translate("MainWindow", "Show", 0, QApplication::UnicodeUTF8));
menuHelp->setTitle(QApplication::translate("MainWindow", "Help", 0, QApplication::UnicodeUTF8));
toolBar->setWindowTitle(QApplication::translate("MainWindow", "toolBar", 0, QApplication::UnicodeUTF8));
} // retranslateUi
};
namespace Ui {
class MainWindow: public Ui_MainWindow {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_MAINWINDOW_H