mirror of https://github.com/CGAL/cgal
Merge pull request #2759 from maxGimeno/Minor_feature_requests-GF
Polyhedron demo: small new features
This commit is contained in:
commit
36514e2c65
|
|
@ -151,6 +151,9 @@ MainWindow::MainWindow(QWidget* parent)
|
||||||
QShortcut* shortcut = new QShortcut(QKeySequence(Qt::ALT+Qt::Key_Q), this);
|
QShortcut* shortcut = new QShortcut(QKeySequence(Qt::ALT+Qt::Key_Q), this);
|
||||||
connect(shortcut, SIGNAL(activated()),
|
connect(shortcut, SIGNAL(activated()),
|
||||||
this, SLOT(setFocusToQuickSearch()));
|
this, SLOT(setFocusToQuickSearch()));
|
||||||
|
shortcut = new QShortcut(QKeySequence(Qt::Key_F5), this);
|
||||||
|
connect(shortcut, SIGNAL(activated()),
|
||||||
|
this, SLOT(reloadItem()));
|
||||||
}
|
}
|
||||||
|
|
||||||
proxyModel = new QSortFilterProxyModel(this);
|
proxyModel = new QSortFilterProxyModel(this);
|
||||||
|
|
@ -888,27 +891,18 @@ void MainWindow::updateViewerBBox(bool recenter = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::reloadItem() {
|
void MainWindow::reloadItem() {
|
||||||
QAction* sender_action = qobject_cast<QAction*>(sender());
|
|
||||||
if(!sender_action) return;
|
|
||||||
|
|
||||||
Scene_item* item = (Scene_item*)sender_action->data().value<void*>();
|
Scene_item* item = NULL;
|
||||||
if(!item) {
|
|
||||||
std::cerr << "Cannot reload item: "
|
Q_FOREACH(Scene::Item_id id, scene->selectionIndices())
|
||||||
<< "the reload action has not item attached\n";
|
{
|
||||||
return;
|
item = scene->item(id);
|
||||||
}
|
|
||||||
if(!item) {
|
|
||||||
std::cerr << "Cannot reload item: "
|
|
||||||
<< "the reload action has a QObject* pointer attached\n"
|
|
||||||
<< "that is not a Scene_item*\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QString filename = item->property("source filename").toString();
|
QString filename = item->property("source filename").toString();
|
||||||
QString loader_name = item->property("loader_name").toString();
|
QString loader_name = item->property("loader_name").toString();
|
||||||
if(filename.isEmpty() || loader_name.isEmpty()) {
|
if(filename.isEmpty() || loader_name.isEmpty()) {
|
||||||
std::cerr << "Cannot reload item: "
|
this->warning(QString("Cannot reload item %1: "
|
||||||
<< "the item has no \"source filename\" or no \"loader_name\" attached\n";
|
"the item has no \"source filename\" or no \"loader_name\" attached\n").arg(item->name()));
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGAL::Three::Polyhedron_demo_io_plugin_interface* fileloader = findLoader(loader_name);
|
CGAL::Three::Polyhedron_demo_io_plugin_interface* fileloader = findLoader(loader_name);
|
||||||
|
|
@ -926,6 +920,7 @@ void MainWindow::reloadItem() {
|
||||||
scene->replaceItem(scene->item_id(item), new_item, true);
|
scene->replaceItem(scene->item_id(item), new_item, true);
|
||||||
new_item->invalidateOpenGLBuffers();
|
new_item->invalidateOpenGLBuffers();
|
||||||
item->deleteLater();
|
item->deleteLater();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CGAL::Three::Polyhedron_demo_io_plugin_interface* MainWindow::findLoader(const QString& loader_name) const {
|
CGAL::Three::Polyhedron_demo_io_plugin_interface* MainWindow::findLoader(const QString& loader_name) const {
|
||||||
|
|
@ -1280,7 +1275,7 @@ void MainWindow::showSceneContextMenu(int selectedItemIndex,
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
if(!item->property("source filename").toString().isEmpty()) {
|
if(!item->property("source filename").toString().isEmpty()) {
|
||||||
QAction* reload = menu->addAction(tr("&Reload Item from File"));
|
QAction* reload = menu->addAction(tr("&Reload Item from File"));
|
||||||
reload->setData(qVariantFromValue((void*)item));
|
reload->setProperty("is_groupable", true);
|
||||||
connect(reload, SIGNAL(triggered()),
|
connect(reload, SIGNAL(triggered()),
|
||||||
this, SLOT(reloadItem()));
|
this, SLOT(reloadItem()));
|
||||||
}
|
}
|
||||||
|
|
@ -1304,8 +1299,8 @@ void MainWindow::showSceneContextMenu(int selectedItemIndex,
|
||||||
void MainWindow::showSceneContextMenu(const QPoint& p) {
|
void MainWindow::showSceneContextMenu(const QPoint& p) {
|
||||||
QWidget* sender = qobject_cast<QWidget*>(this->sender());
|
QWidget* sender = qobject_cast<QWidget*>(this->sender());
|
||||||
if(!sender) return;
|
if(!sender) return;
|
||||||
|
int main_index = scene->selectionIndices().first();
|
||||||
|
|
||||||
int index = -1;
|
|
||||||
if(sender == sceneView) {
|
if(sender == sceneView) {
|
||||||
QModelIndex modelIndex = sceneView->indexAt(p);
|
QModelIndex modelIndex = sceneView->indexAt(p);
|
||||||
if(!modelIndex.isValid())
|
if(!modelIndex.isValid())
|
||||||
|
|
@ -1323,17 +1318,48 @@ void MainWindow::showSceneContextMenu(const QPoint& p) {
|
||||||
menu->exec(sender->mapToGlobal(p));
|
menu->exec(sender->mapToGlobal(p));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else if(scene->selectionIndices().size() > 1 )
|
||||||
{
|
{
|
||||||
index = scene->getIdFromModelIndex(proxyModel->mapToSource(modelIndex));
|
QMap<QString, QAction*> menu_actions;
|
||||||
scene->setSelectedItemIndex(index);
|
Q_FOREACH(QAction* action, scene->item(main_index)->contextMenu()->actions())
|
||||||
|
{
|
||||||
|
if(action->property("is_groupable").toBool())
|
||||||
|
menu_actions[action->text()] = action;
|
||||||
|
}
|
||||||
|
Q_FOREACH(Scene::Item_id index, scene->selectionIndices())
|
||||||
|
{
|
||||||
|
if(index == main_index)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
CGAL::Three::Scene_item* item = scene->item(index);
|
||||||
|
if(!item)
|
||||||
|
continue;
|
||||||
|
QVector<QString> action_names;
|
||||||
|
Q_FOREACH(QAction* action, item->contextMenu()->actions())
|
||||||
|
{
|
||||||
|
action_names.push_back(action->text());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
QMenu menu;
|
||||||
index = scene->mainSelectionIndex();
|
Q_FOREACH(QString name, menu_actions.keys())
|
||||||
|
{
|
||||||
|
QAction* action = menu.addAction(name);
|
||||||
|
connect(action, &QAction::triggered, this, &MainWindow::propagate_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
showSceneContextMenu(index, sender->mapToGlobal(p));
|
QAction* reload = menu.addAction(tr("&Reload Item from File"));
|
||||||
|
reload->setProperty("is_groupable", true);
|
||||||
|
connect(reload, SIGNAL(triggered()),
|
||||||
|
this, SLOT(reloadItem()));
|
||||||
|
QAction* saveas = menu.addAction(tr("&Save as..."));
|
||||||
|
connect(saveas, SIGNAL(triggered()),
|
||||||
|
this, SLOT(on_actionSaveAs_triggered()));
|
||||||
|
menu.exec(sender->mapToGlobal(p));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
showSceneContextMenu(main_index, sender->mapToGlobal(p));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::removeManipulatedFrame(CGAL::Three::Scene_item* item)
|
void MainWindow::removeManipulatedFrame(CGAL::Three::Scene_item* item)
|
||||||
|
|
@ -1547,18 +1573,10 @@ void MainWindow::on_actionLoad_triggered()
|
||||||
void MainWindow::on_actionSaveAs_triggered()
|
void MainWindow::on_actionSaveAs_triggered()
|
||||||
{
|
{
|
||||||
Scene_item* item = NULL;
|
Scene_item* item = NULL;
|
||||||
QAction* sender_action = qobject_cast<QAction*>(sender());
|
|
||||||
if(sender_action && !sender_action->data().isNull()) {
|
|
||||||
item = (Scene_item*)sender_action->data().value<void*>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!item)
|
Q_FOREACH(Scene::Item_id id, scene->selectionIndices())
|
||||||
{
|
{
|
||||||
item = scene->item(scene->mainSelectionIndex());
|
item = scene->item(id);
|
||||||
}
|
|
||||||
if(!item)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QVector<CGAL::Three::Polyhedron_demo_io_plugin_interface*> canSavePlugins;
|
QVector<CGAL::Three::Polyhedron_demo_io_plugin_interface*> canSavePlugins;
|
||||||
QStringList filters;
|
QStringList filters;
|
||||||
Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin, io_plugins) {
|
Q_FOREACH(CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin, io_plugins) {
|
||||||
|
|
@ -1567,36 +1585,56 @@ void MainWindow::on_actionSaveAs_triggered()
|
||||||
filters += plugin->saveNameFilters();
|
filters += plugin->saveNameFilters();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QString ext;
|
QString ext1, ext2;
|
||||||
if(!filters.isEmpty())
|
|
||||||
{
|
|
||||||
QRegExp extensions("\\(\\*\\..+\\)");
|
QRegExp extensions("\\(\\*\\..+\\)");
|
||||||
extensions.indexIn(filters.first().split(";;").first());
|
QStringList filter_ext;
|
||||||
ext = extensions.cap();
|
Q_FOREACH(QString s, filters.first().split(";;"))
|
||||||
filters << tr("All files (*)");
|
{
|
||||||
|
int pos = extensions.indexIn(s);
|
||||||
|
if( pos >-1)
|
||||||
|
filter_ext.append(extensions.capturedTexts());
|
||||||
}
|
}
|
||||||
|
filters << tr("All files (*)");
|
||||||
if(canSavePlugins.isEmpty()) {
|
if(canSavePlugins.isEmpty()) {
|
||||||
QMessageBox::warning(this,
|
QMessageBox::warning(this,
|
||||||
tr("Cannot save"),
|
tr("Cannot save"),
|
||||||
tr("The selected object %1 cannot be saved.")
|
tr("The selected object %1 cannot be saved.")
|
||||||
.arg(item->name()));
|
.arg(item->name()));
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
QString caption = tr("Save %1 to File...%2").arg(item->name()).arg(ext);
|
QString caption = tr("Save %1 to File...").arg(item->name());
|
||||||
//remove `)`
|
QString sf;
|
||||||
ext.chop(1);
|
|
||||||
//remove `(*.`
|
|
||||||
ext = ext.right(ext.size()-3);
|
|
||||||
QString filename =
|
QString filename =
|
||||||
QFileDialog::getSaveFileName(this,
|
QFileDialog::getSaveFileName(this,
|
||||||
caption,
|
caption,
|
||||||
QString("%1.%2").arg(item->name()).arg(ext),
|
QString("%1").arg(item->name()),
|
||||||
filters.join(";;"));
|
filters.join(";;"),
|
||||||
|
&sf);
|
||||||
|
extensions.indexIn(sf.split(";;").first());
|
||||||
|
ext1 = extensions.cap();
|
||||||
|
//remove `)`
|
||||||
|
ext1.chop(1);
|
||||||
|
//remove `(*`
|
||||||
|
ext1 = ext1.right(ext1.size()-2);
|
||||||
if(filename.isEmpty())
|
if(filename.isEmpty())
|
||||||
return;
|
continue;
|
||||||
|
|
||||||
|
ext2 = filename.split(".").last();
|
||||||
|
QStringList final_extensions;
|
||||||
|
Q_FOREACH(QString s, filter_ext)
|
||||||
|
{
|
||||||
|
//remove `)`
|
||||||
|
s.chop(1);
|
||||||
|
//remove `(*.`
|
||||||
|
final_extensions.append(s.right(s.size()-3));
|
||||||
|
}
|
||||||
|
if(!final_extensions.contains(ext2))
|
||||||
|
{
|
||||||
|
filename = filename.append(ext1);
|
||||||
|
}
|
||||||
viewer->update();
|
viewer->update();
|
||||||
save(filename, item);
|
save(filename, item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::save(QString filename, CGAL::Three::Scene_item* item) {
|
void MainWindow::save(QString filename, CGAL::Three::Scene_item* item) {
|
||||||
|
|
@ -2118,3 +2156,22 @@ void MainWindow::exportStatistics()
|
||||||
outStream << str;
|
outStream << str;
|
||||||
output.close();
|
output.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::propagate_action()
|
||||||
|
{
|
||||||
|
QAction* sender = qobject_cast<QAction*>(this->sender());
|
||||||
|
if(!sender) return;
|
||||||
|
QString name = sender->text();
|
||||||
|
Q_FOREACH(Scene::Item_id id, scene->selectionIndices())
|
||||||
|
{
|
||||||
|
Scene_item* item = scene->item(id);
|
||||||
|
Q_FOREACH(QAction* action, item->contextMenu()->actions())
|
||||||
|
{
|
||||||
|
if(action->text() == name)
|
||||||
|
{
|
||||||
|
action->trigger();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -354,6 +354,8 @@ protected Q_SLOTS:
|
||||||
void on_actionRecenterScene_triggered();
|
void on_actionRecenterScene_triggered();
|
||||||
//!Resizes the header of the scene view
|
//!Resizes the header of the scene view
|
||||||
void resetHeader();
|
void resetHeader();
|
||||||
|
//!apply an action named `name` to all selected items
|
||||||
|
void propagate_action();
|
||||||
protected:
|
protected:
|
||||||
QList<QAction*> createSubMenus(QList<QAction*>);
|
QList<QAction*> createSubMenus(QList<QAction*>);
|
||||||
/*! For each objects in the Geometric Objects view, loads the associated plugins.
|
/*! For each objects in the Geometric Objects view, loads the associated plugins.
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,7 @@ Polyhedron_demo_off_plugin::load_obj(QFileInfo fileinfo) {
|
||||||
std::move(faces),
|
std::move(faces),
|
||||||
*(poly_item->polyhedron()));
|
*(poly_item->polyhedron()));
|
||||||
item = poly_item;
|
item = poly_item;
|
||||||
|
item->invalidateOpenGLBuffers();
|
||||||
} else {
|
} else {
|
||||||
Scene_polygon_soup_item* polygon_soup_item = new Scene_polygon_soup_item();
|
Scene_polygon_soup_item* polygon_soup_item = new Scene_polygon_soup_item();
|
||||||
polygon_soup_item->load(std::move(points), std::move(faces));
|
polygon_soup_item->load(std::move(points), std::move(faces));
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "Scene_surface_mesh_item.h"
|
#include "Scene_surface_mesh_item.h"
|
||||||
#include "Scene_polygon_soup_item.h"
|
#include "Scene_polygon_soup_item.h"
|
||||||
|
|
@ -35,7 +37,9 @@ public:
|
||||||
return QList<QAction*>();
|
return QList<QAction*>();
|
||||||
}
|
}
|
||||||
QString name() const { return "surface_mesh_io_plugin"; }
|
QString name() const { return "surface_mesh_io_plugin"; }
|
||||||
QString nameFilters() const { return "OFF files to Surface_mesh (*.off);;Wavefront Surface_mesh OBJ (*.obj)"; }
|
QString loadNameFilters() const { return "OFF files to Surface_mesh (*.off);;Wavefront Surface_mesh OBJ (*.obj)"; }
|
||||||
|
QString saveNameFilters() const { return "OFF files (*.off);;Wavefront OBJ (*.obj)"; }
|
||||||
|
QString nameFilters() const { return QString(); }
|
||||||
bool canLoad() const { return true; }
|
bool canLoad() const { return true; }
|
||||||
CGAL::Three::Scene_item* load(QFileInfo fileinfo) {
|
CGAL::Three::Scene_item* load(QFileInfo fileinfo) {
|
||||||
if(fileinfo.suffix().toLower() == "off")
|
if(fileinfo.suffix().toLower() == "off")
|
||||||
|
|
@ -68,6 +72,24 @@ public:
|
||||||
}
|
}
|
||||||
Scene_surface_mesh_item* item = new Scene_surface_mesh_item(surface_mesh);
|
Scene_surface_mesh_item* item = new Scene_surface_mesh_item(surface_mesh);
|
||||||
item->setName(fileinfo.completeBaseName());
|
item->setName(fileinfo.completeBaseName());
|
||||||
|
std::size_t isolated_v = 0;
|
||||||
|
BOOST_FOREACH(vertex_descriptor v, vertices(*surface_mesh))
|
||||||
|
{
|
||||||
|
if(surface_mesh->is_isolated(v))
|
||||||
|
{
|
||||||
|
++isolated_v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(isolated_v >0)
|
||||||
|
{
|
||||||
|
item->setNbIsolatedvertices(isolated_v);
|
||||||
|
//needs two restore, it's not a typo
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
QMessageBox::warning((QWidget*)NULL,
|
||||||
|
tr("Isolated vertices"),
|
||||||
|
tr("%1 isolated vertices found")
|
||||||
|
.arg(item->getNbIsolatedvertices()));
|
||||||
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
else if(fileinfo.suffix().toLower() == "obj")
|
else if(fileinfo.suffix().toLower() == "obj")
|
||||||
|
|
@ -86,8 +108,8 @@ public:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
bool canSave(const CGAL::Three::Scene_item* ) {
|
bool canSave(const CGAL::Three::Scene_item* item) {
|
||||||
return true;
|
return qobject_cast<const Scene_surface_mesh_item*>(item) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo) {
|
bool save(const CGAL::Three::Scene_item* item, QFileInfo fileinfo) {
|
||||||
|
|
|
||||||
|
|
@ -195,16 +195,36 @@ public:
|
||||||
lastMatrix.setToIdentity();
|
lastMatrix.setToIdentity();
|
||||||
mw = _mw;
|
mw = _mw;
|
||||||
this->scene = scene_interface;
|
this->scene = scene_interface;
|
||||||
actionTransformPolyhedron = new QAction("Affine Transformation", mw);
|
|
||||||
|
|
||||||
|
actionTransformPolyhedron = new QAction(
|
||||||
|
#ifdef CGAL_USE_SURFACE_MESH
|
||||||
|
tr("Affine Transformation for Surface Mesh")
|
||||||
|
#else
|
||||||
|
tr("Affine Transformation for Polyhedron")
|
||||||
|
#endif
|
||||||
|
, mw);
|
||||||
if(actionTransformPolyhedron) {
|
if(actionTransformPolyhedron) {
|
||||||
connect(actionTransformPolyhedron, SIGNAL(triggered()),this, SLOT(go()));
|
connect(actionTransformPolyhedron, SIGNAL(triggered()),this, SLOT(go()));
|
||||||
}
|
}
|
||||||
transform_item = NULL;
|
transform_item = NULL;
|
||||||
transform_points_item = NULL;
|
transform_points_item = NULL;
|
||||||
|
|
||||||
dock_widget = new QDockWidget(mw);
|
dock_widget = new QDockWidget(
|
||||||
|
#ifdef CGAL_USE_SURFACE_MESH
|
||||||
|
tr("Affine Transformation for Surface Mesh")
|
||||||
|
#else
|
||||||
|
tr("Affine Transformation for Polyhedron")
|
||||||
|
#endif
|
||||||
|
, mw);
|
||||||
ui.setupUi(dock_widget);
|
ui.setupUi(dock_widget);
|
||||||
|
dock_widget->setWindowTitle(tr(
|
||||||
|
#ifdef CGAL_USE_SURFACE_MESH
|
||||||
|
"Affine Transformation for Surface Mesh"
|
||||||
|
#else
|
||||||
|
"Affine Transformation for Polyhedron"
|
||||||
|
#endif
|
||||||
|
));
|
||||||
addDockWidget(dock_widget);
|
addDockWidget(dock_widget);
|
||||||
dock_widget->hide();
|
dock_widget->hide();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,12 @@ dock_widget->show();
|
||||||
item = new Scene_edit_box_item(scene);
|
item = new Scene_edit_box_item(scene);
|
||||||
connect(item, SIGNAL(destroyed()),
|
connect(item, SIGNAL(destroyed()),
|
||||||
this, SLOT(enableAction()));
|
this, SLOT(enableAction()));
|
||||||
|
connect(item, &Scene_edit_box_item::aboutToBeDestroyed,
|
||||||
|
this, [this]()
|
||||||
|
{
|
||||||
|
clip(false);
|
||||||
|
dock_widget->pushButton->setChecked(false);
|
||||||
|
});
|
||||||
item->setName("Clipping box");
|
item->setName("Clipping box");
|
||||||
item->setRenderingMode(FlatPlusEdges);
|
item->setRenderingMode(FlatPlusEdges);
|
||||||
QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
|
QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@ public:
|
||||||
void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*);
|
void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*);
|
||||||
QList<QAction*> actions() const;
|
QList<QAction*> actions() const;
|
||||||
bool applicable(QAction*) const {
|
bool applicable(QAction*) const {
|
||||||
if(scene->mainSelectionIndex() != -1)
|
if(scene->mainSelectionIndex() != -1
|
||||||
|
&& scene->item(scene->mainSelectionIndex())->isFinite())
|
||||||
return true;
|
return true;
|
||||||
return false;}
|
return false;}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -995,6 +995,8 @@ void Scene_edit_box_item_priv::reset_selection()
|
||||||
//intercept events for picking
|
//intercept events for picking
|
||||||
bool Scene_edit_box_item::eventFilter(QObject *obj, QEvent *event)
|
bool Scene_edit_box_item::eventFilter(QObject *obj, QEvent *event)
|
||||||
{
|
{
|
||||||
|
if(!visible())
|
||||||
|
return false;
|
||||||
QGLViewer* viewer = qobject_cast<QGLViewer*>(obj);
|
QGLViewer* viewer = qobject_cast<QGLViewer*>(obj);
|
||||||
if(!viewer)
|
if(!viewer)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -57,16 +57,35 @@ public:
|
||||||
mw = mainWindow;
|
mw = mainWindow;
|
||||||
scene = scene_interface;
|
scene = scene_interface;
|
||||||
messages = m;
|
messages = m;
|
||||||
actionFairing = new QAction(tr("Refinement and Fairing"), mw);
|
actionFairing = new QAction(tr(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"Refinement and Fairing for Surface Mesh"
|
||||||
|
#else
|
||||||
|
"Refinement and Fairing for Polyhedron"
|
||||||
|
#endif
|
||||||
|
), mw);
|
||||||
actionFairing->setProperty("subMenuName", "Polygon Mesh Processing");
|
actionFairing->setProperty("subMenuName", "Polygon Mesh Processing");
|
||||||
|
|
||||||
connect(actionFairing, SIGNAL(triggered()), this, SLOT(fairing_action()));
|
connect(actionFairing, SIGNAL(triggered()), this, SLOT(fairing_action()));
|
||||||
|
|
||||||
dock_widget = new QDockWidget("Refinement and Fairing", mw);
|
dock_widget = new QDockWidget(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"Refinement and Fairing for Surface Mesh"
|
||||||
|
#else
|
||||||
|
"Refinement and Fairing for Polyhedron"
|
||||||
|
#endif
|
||||||
|
, mw);
|
||||||
dock_widget->setVisible(false);
|
dock_widget->setVisible(false);
|
||||||
|
|
||||||
ui_widget.setupUi(dock_widget);
|
ui_widget.setupUi(dock_widget);
|
||||||
addDockWidget(dock_widget);
|
addDockWidget(dock_widget);
|
||||||
|
dock_widget->setWindowTitle(tr(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"Fairing for Surface Mesh"
|
||||||
|
#else
|
||||||
|
"Fairing for Polyhedron"
|
||||||
|
#endif
|
||||||
|
));
|
||||||
|
|
||||||
connect(ui_widget.Fair_button, SIGNAL(clicked()), this, SLOT(on_Fair_button_clicked()));
|
connect(ui_widget.Fair_button, SIGNAL(clicked()), this, SLOT(on_Fair_button_clicked()));
|
||||||
connect(ui_widget.Refine_button, SIGNAL(clicked()), this, SLOT(on_Refine_button_clicked()));
|
connect(ui_widget.Refine_button, SIGNAL(clicked()), this, SLOT(on_Refine_button_clicked()));
|
||||||
|
|
|
||||||
|
|
@ -435,11 +435,23 @@ void Polyhedron_demo_hole_filling_plugin::init(QMainWindow* mainWindow,
|
||||||
scene = scene_interface;
|
scene = scene_interface;
|
||||||
messages = m;
|
messages = m;
|
||||||
|
|
||||||
actionHoleFilling = new QAction(tr("Hole Filling"), mw);
|
actionHoleFilling = new QAction(tr(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"Hole Filling for Surface Mesh"
|
||||||
|
#else
|
||||||
|
"Hole Filling for Polyhedron"
|
||||||
|
#endif
|
||||||
|
), mw);
|
||||||
actionHoleFilling->setProperty("subMenuName", "Polygon Mesh Processing");
|
actionHoleFilling->setProperty("subMenuName", "Polygon Mesh Processing");
|
||||||
connect(actionHoleFilling, SIGNAL(triggered()), this, SLOT(hole_filling_action()));
|
connect(actionHoleFilling, SIGNAL(triggered()), this, SLOT(hole_filling_action()));
|
||||||
|
|
||||||
dock_widget = new QDockWidget("Hole Filling", mw);
|
dock_widget = new QDockWidget(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"Hole Filling for Surface Mesh"
|
||||||
|
#else
|
||||||
|
"Hole Filling for Polyhedron"
|
||||||
|
#endif
|
||||||
|
, mw);
|
||||||
dock_widget->setVisible(false);
|
dock_widget->setVisible(false);
|
||||||
dock_widget->installEventFilter(this);
|
dock_widget->installEventFilter(this);
|
||||||
|
|
||||||
|
|
@ -448,6 +460,13 @@ void Polyhedron_demo_hole_filling_plugin::init(QMainWindow* mainWindow,
|
||||||
ui_widget.Reject_button->setVisible(false);
|
ui_widget.Reject_button->setVisible(false);
|
||||||
|
|
||||||
addDockWidget(dock_widget);
|
addDockWidget(dock_widget);
|
||||||
|
dock_widget->setWindowTitle(tr(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"Hole Filling for Surface Mesh"
|
||||||
|
#else
|
||||||
|
"Hole Filling for Polyhedron"
|
||||||
|
#endif
|
||||||
|
));
|
||||||
|
|
||||||
connect(ui_widget.Fill_from_selection_button, SIGNAL(clicked()), this, SLOT(on_Fill_from_selection_button()));
|
connect(ui_widget.Fill_from_selection_button, SIGNAL(clicked()), this, SLOT(on_Fill_from_selection_button()));
|
||||||
connect(ui_widget.Visualize_holes_button, SIGNAL(clicked()), this, SLOT(on_Visualize_holes_button()));
|
connect(ui_widget.Visualize_holes_button, SIGNAL(clicked()), this, SLOT(on_Visualize_holes_button()));
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,13 @@ public:
|
||||||
dockWidget = NULL;
|
dockWidget = NULL;
|
||||||
ui = NULL;
|
ui = NULL;
|
||||||
|
|
||||||
actionMCFSkeleton = new QAction(tr("Mean Curvature Skeleton (Advanced)"), mainWindow);
|
actionMCFSkeleton = new QAction(tr(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"Mean Curvature Skeleton (Advanced) for Surface Mesh"
|
||||||
|
#else
|
||||||
|
"Mean Curvature Skeleton (Advanced) for Polyhedron"
|
||||||
|
#endif
|
||||||
|
), mainWindow);
|
||||||
actionMCFSkeleton->setProperty("subMenuName", "Triangulated Surface Mesh Skeletonization");
|
actionMCFSkeleton->setProperty("subMenuName", "Triangulated Surface Mesh Skeletonization");
|
||||||
actionMCFSkeleton->setObjectName("actionMCFSkeleton");
|
actionMCFSkeleton->setObjectName("actionMCFSkeleton");
|
||||||
|
|
||||||
|
|
@ -126,14 +132,26 @@ public:
|
||||||
actionConvert_to_medial_skeleton->setProperty("subMenuName", "Triangulated Surface Mesh Skeletonization");
|
actionConvert_to_medial_skeleton->setProperty("subMenuName", "Triangulated Surface Mesh Skeletonization");
|
||||||
actionConvert_to_medial_skeleton->setObjectName("actionConvert_to_medial_skeleton");
|
actionConvert_to_medial_skeleton->setObjectName("actionConvert_to_medial_skeleton");
|
||||||
|
|
||||||
dockWidget = new QDockWidget(mw);
|
dockWidget = new QDockWidget(tr(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"Mean Curvature Skeleton for Surface Mesh"
|
||||||
|
#else
|
||||||
|
"Mean Curvature Skeleton for Polyhedron"
|
||||||
|
#endif
|
||||||
|
),mw);
|
||||||
dockWidget->setVisible(false);
|
dockWidget->setVisible(false);
|
||||||
ui = new Ui::Mean_curvature_flow_skeleton_plugin();
|
ui = new Ui::Mean_curvature_flow_skeleton_plugin();
|
||||||
ui->setupUi(dockWidget);
|
ui->setupUi(dockWidget);
|
||||||
dockWidget->setFeatures(QDockWidget::DockWidgetMovable
|
dockWidget->setFeatures(QDockWidget::DockWidgetMovable
|
||||||
| QDockWidget::DockWidgetFloatable
|
| QDockWidget::DockWidgetFloatable
|
||||||
| QDockWidget::DockWidgetClosable);
|
| QDockWidget::DockWidgetClosable);
|
||||||
dockWidget->setWindowTitle("Mean Curvature Flow Skeleton");
|
dockWidget->setWindowTitle(tr(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"Mean Curvature Skeleton for Surface Mesh"
|
||||||
|
#else
|
||||||
|
"Mean Curvature Skeleton for Polyhedron"
|
||||||
|
#endif
|
||||||
|
));
|
||||||
addDockWidget(dockWidget);
|
addDockWidget(dockWidget);
|
||||||
|
|
||||||
connect(ui->pushButton_contract, SIGNAL(clicked()),
|
connect(ui->pushButton_contract, SIGNAL(clicked()),
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
#include <CGAL/Polygon_2.h>
|
#include <CGAL/Polygon_2.h>
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
#include <QGLViewer/manipulatedCameraFrame.h>
|
#include <QGLViewer/manipulatedCameraFrame.h>
|
||||||
|
#include <CGAL/Search_traits_3.h>
|
||||||
|
#include <CGAL/Orthogonal_k_neighbor_search.h>
|
||||||
#include "opengl_tools.h"
|
#include "opengl_tools.h"
|
||||||
|
|
||||||
#include "Messages_interface.h"
|
#include "Messages_interface.h"
|
||||||
|
|
@ -22,6 +24,7 @@
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
@ -225,10 +228,18 @@ public:
|
||||||
|
|
||||||
connect(ui_widget.box, SIGNAL(toggled(bool)),
|
connect(ui_widget.box, SIGNAL(toggled(bool)),
|
||||||
this, SLOT(on_box_toggled(bool)));
|
this, SLOT(on_box_toggled(bool)));
|
||||||
|
connect(ui_widget.helpButton, &QAbstractButton::clicked,
|
||||||
|
[this](){
|
||||||
|
QMessageBox::information(dock_widget, QString("Help"),
|
||||||
|
QString("SHIFT + Left Click : selection\n"
|
||||||
|
"CONTROL + Left Click : print coordinates of point under cursor."));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
visualizer = NULL;
|
visualizer = NULL;
|
||||||
edit_box = NULL;
|
edit_box = NULL;
|
||||||
shift_pressing = false;
|
shift_pressing = false;
|
||||||
|
ctrl_pressing = false;
|
||||||
|
|
||||||
QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
|
QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
|
||||||
viewer->installEventFilter(this);
|
viewer->installEventFilter(this);
|
||||||
|
|
@ -260,6 +271,7 @@ protected:
|
||||||
Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
|
Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
|
||||||
|
|
||||||
shift_pressing = modifiers.testFlag(Qt::ShiftModifier);
|
shift_pressing = modifiers.testFlag(Qt::ShiftModifier);
|
||||||
|
ctrl_pressing = modifiers.testFlag(Qt::ControlModifier);
|
||||||
#if QGLVIEWER_VERSION >= 0x020700
|
#if QGLVIEWER_VERSION >= 0x020700
|
||||||
background = static_cast<CGAL::Three::Viewer_interface*>(*QGLViewer::QGLViewerPool().begin())->grabFramebuffer();
|
background = static_cast<CGAL::Three::Viewer_interface*>(*QGLViewer::QGLViewerPool().begin())->grabFramebuffer();
|
||||||
#else
|
#else
|
||||||
|
|
@ -310,7 +322,32 @@ protected:
|
||||||
visualizer->sample_mouse_path(background);
|
visualizer->sample_mouse_path(background);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
//Position request
|
||||||
|
else if(ctrl_pressing && event->type() == QEvent::MouseButtonPress)
|
||||||
|
{
|
||||||
|
QMouseEvent* m_e = static_cast<QMouseEvent*>(event);
|
||||||
|
Scene_points_with_normal_item* item =
|
||||||
|
qobject_cast<Scene_points_with_normal_item*>(scene->item(scene->mainSelectionIndex()));
|
||||||
|
if(!item)
|
||||||
|
return false;
|
||||||
|
QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin();
|
||||||
|
bool found = false;
|
||||||
|
QPoint pixel(m_e->pos().x(),
|
||||||
|
viewer->camera()->screenHeight()-1-m_e->pos().y());
|
||||||
|
qglviewer::Vec point = viewer->camera()->pointUnderPixel(m_e->pos(),
|
||||||
|
found);
|
||||||
|
if(!found)
|
||||||
|
return false;
|
||||||
|
typedef Kernel::Point_3 Point;
|
||||||
|
typedef CGAL::Search_traits_3<Kernel> TreeTraits;
|
||||||
|
typedef CGAL::Orthogonal_k_neighbor_search<TreeTraits> Neighbor_search;
|
||||||
|
typedef Neighbor_search::Tree Tree;
|
||||||
|
Tree tree(item->point_set()->points().begin(), item->point_set()->points().end());
|
||||||
|
|
||||||
|
Neighbor_search search(tree, Point(point.x, point.y, point.z), 1);
|
||||||
|
Point res = search.begin()->first;
|
||||||
|
messages->information(QString("Selected point : (%1, %2, %3)").arg(res.x()).arg(res.y()).arg(res.z()));
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -563,6 +600,7 @@ public Q_SLOTS:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void reset_editbox()
|
void reset_editbox()
|
||||||
{
|
{
|
||||||
edit_box = NULL;
|
edit_box = NULL;
|
||||||
|
|
@ -578,6 +616,7 @@ private:
|
||||||
Ui::PointSetSelection ui_widget;
|
Ui::PointSetSelection ui_widget;
|
||||||
Scene_point_set_selection_visualizer* visualizer;
|
Scene_point_set_selection_visualizer* visualizer;
|
||||||
bool shift_pressing;
|
bool shift_pressing;
|
||||||
|
bool ctrl_pressing;
|
||||||
Scene_edit_box_item* edit_box;
|
Scene_edit_box_item* edit_box;
|
||||||
|
|
||||||
}; // end Polyhedron_demo_point_set_selection_plugin
|
}; // end Polyhedron_demo_point_set_selection_plugin
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>389</width>
|
<width>514</width>
|
||||||
<height>101</height>
|
<height>281</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
@ -254,6 +254,26 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="helpButton">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../Polyhedron_3.qrc">
|
||||||
|
<normaloff>:/cgal/icons/resources/help_button.png</normaloff>:/cgal/icons/resources/help_button.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
@ -287,6 +307,9 @@
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../Polyhedron_3.qrc"/>
|
<include location="../../Polyhedron_3.qrc"/>
|
||||||
|
<include location="../../Polyhedron_3.qrc"/>
|
||||||
|
<include location="../../Polyhedron_3.qrc"/>
|
||||||
|
<include location="../../Polyhedron_3.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
||||||
|
|
@ -385,9 +385,27 @@ public:
|
||||||
autoConnectActions();
|
autoConnectActions();
|
||||||
Q_FOREACH(QAction *action, _actions)
|
Q_FOREACH(QAction *action, _actions)
|
||||||
action->setProperty("subMenuName",
|
action->setProperty("subMenuName",
|
||||||
"Triangulated Surface Mesh Parameterization");
|
#ifdef USE_SURFACE_MESH
|
||||||
dock_widget = new QDockWidget("UVMapping", mw);
|
"Triangulated Surface Mesh Parameterization"
|
||||||
|
#else
|
||||||
|
"Triangulated Surface Mesh Parameterization for Polyhedron"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
dock_widget = new QDockWidget(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"UVMapping for Surface Mesh"
|
||||||
|
#else
|
||||||
|
"UVMapping for Polyhedron"
|
||||||
|
#endif
|
||||||
|
, mw);
|
||||||
ui_widget.setupUi(dock_widget);
|
ui_widget.setupUi(dock_widget);
|
||||||
|
dock_widget->setWindowTitle(tr(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"UVMapping for Surface Mesh"
|
||||||
|
#else
|
||||||
|
"UVMapping for Polyhedron"
|
||||||
|
#endif
|
||||||
|
));
|
||||||
graphics_scene = new QGraphicsScene(dock_widget);
|
graphics_scene = new QGraphicsScene(dock_widget);
|
||||||
ui_widget.graphicsView->setScene(graphics_scene);
|
ui_widget.graphicsView->setScene(graphics_scene);
|
||||||
ui_widget.graphicsView->setRenderHints(QPainter::Antialiasing);
|
ui_widget.graphicsView->setRenderHints(QPainter::Antialiasing);
|
||||||
|
|
|
||||||
|
|
@ -89,17 +89,36 @@ public:
|
||||||
this->mw = mainWindow;
|
this->mw = mainWindow;
|
||||||
this->m_messages = messages;
|
this->m_messages = messages;
|
||||||
|
|
||||||
dock_widget = new QDockWidget("Shortest path", mw);
|
dock_widget = new QDockWidget(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"Shortest Path for Surface Mesh"
|
||||||
|
#else
|
||||||
|
"Shortest Path for Polyhedron"
|
||||||
|
#endif
|
||||||
|
, mw);
|
||||||
|
|
||||||
dock_widget->setVisible(false);
|
dock_widget->setVisible(false);
|
||||||
|
|
||||||
ui_widget.setupUi(dock_widget);
|
ui_widget.setupUi(dock_widget);
|
||||||
|
dock_widget->setWindowTitle(tr(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"Shortest Path for Surface Mesh"
|
||||||
|
#else
|
||||||
|
"Shortest Path for Polyhedron"
|
||||||
|
#endif
|
||||||
|
));
|
||||||
addDockWidget(dock_widget);
|
addDockWidget(dock_widget);
|
||||||
|
|
||||||
connect(ui_widget.Selection_type_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(on_Selection_type_combo_box_changed(int)));
|
connect(ui_widget.Selection_type_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(on_Selection_type_combo_box_changed(int)));
|
||||||
connect(ui_widget.Primitives_type_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(on_Primitives_type_combo_box_changed(int)));
|
connect(ui_widget.Primitives_type_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(on_Primitives_type_combo_box_changed(int)));
|
||||||
|
|
||||||
actionMakeShortestPaths = new QAction("Make Shortest Path", this->mw);
|
actionMakeShortestPaths = new QAction(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"Make Shortest Path for Surface Mesh"
|
||||||
|
#else
|
||||||
|
"Make Shortest Path for Polyhedron"
|
||||||
|
#endif
|
||||||
|
, this->mw);
|
||||||
actionMakeShortestPaths->setProperty("subMenuName", "Triangulated Surface Mesh Shortest Paths");
|
actionMakeShortestPaths->setProperty("subMenuName", "Triangulated Surface Mesh Shortest Paths");
|
||||||
actionMakeShortestPaths->setObjectName("actionMakeShortestPaths");
|
actionMakeShortestPaths->setObjectName("actionMakeShortestPaths");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,13 @@ void Polyhedron_demo_edit_polyhedron_plugin::init(QMainWindow* mainWindow, CGAL:
|
||||||
{
|
{
|
||||||
mw = mainWindow;
|
mw = mainWindow;
|
||||||
scene = scene_interface;
|
scene = scene_interface;
|
||||||
actionDeformation = new QAction("Surface Mesh Deformation", mw);
|
actionDeformation = new QAction(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"Surface Mesh Deformation"
|
||||||
|
#else
|
||||||
|
" Polyhedron Deformation"
|
||||||
|
#endif
|
||||||
|
, mw);
|
||||||
actionDeformation->setProperty("subMenuName", "Triangulated Surface Mesh Deformation");
|
actionDeformation->setProperty("subMenuName", "Triangulated Surface Mesh Deformation");
|
||||||
actionDeformation->setObjectName("actionDeformation");
|
actionDeformation->setObjectName("actionDeformation");
|
||||||
actionDeformation->setShortcutContext(Qt::ApplicationShortcut);
|
actionDeformation->setShortcutContext(Qt::ApplicationShortcut);
|
||||||
|
|
@ -140,10 +146,24 @@ void Polyhedron_demo_edit_polyhedron_plugin::init(QMainWindow* mainWindow, CGAL:
|
||||||
|
|
||||||
////////////////// Construct widget /////////////////////////////
|
////////////////// Construct widget /////////////////////////////
|
||||||
// First time, construct docking window
|
// First time, construct docking window
|
||||||
dock_widget = new QDockWidget("Mesh Deformation", mw);
|
dock_widget = new QDockWidget(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"Surface Mesh Deformation"
|
||||||
|
#else
|
||||||
|
" Polyhedron Deformation"
|
||||||
|
#endif
|
||||||
|
, mw);
|
||||||
dock_widget->setVisible(false); // do not show at the beginning
|
dock_widget->setVisible(false); // do not show at the beginning
|
||||||
|
|
||||||
ui_widget.setupUi(dock_widget);
|
ui_widget.setupUi(dock_widget);
|
||||||
|
dock_widget->setWindowTitle(tr(
|
||||||
|
#ifdef USE_SURFACE_MESH
|
||||||
|
"Surface Mesh Deformation"
|
||||||
|
#else
|
||||||
|
" Polyhedron Deformation"
|
||||||
|
#endif
|
||||||
|
));
|
||||||
|
|
||||||
mw->addDockWidget(Qt::LeftDockWidgetArea, dock_widget);
|
mw->addDockWidget(Qt::LeftDockWidgetArea, dock_widget);
|
||||||
|
|
||||||
connect(ui_widget.AddCtrlVertPushButton, SIGNAL(clicked()), this, SLOT(on_AddCtrlVertPushButton_clicked()));
|
connect(ui_widget.AddCtrlVertPushButton, SIGNAL(clicked()), this, SLOT(on_AddCtrlVertPushButton_clicked()));
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
<file>resources/pss_union.png</file>
|
<file>resources/pss_union.png</file>
|
||||||
<file>resources/pss_inter.png</file>
|
<file>resources/pss_inter.png</file>
|
||||||
<file>resources/pss_diff.png</file>
|
<file>resources/pss_diff.png</file>
|
||||||
|
<file>resources/help_button.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/cgal/Polyhedron_3">
|
<qresource prefix="/cgal/Polyhedron_3">
|
||||||
<file alias="about.html">resources/about.html</file>
|
<file alias="about.html">resources/about.html</file>
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,15 @@ Scene::erase(QList<int> indices)
|
||||||
&& item->parentGroup()->isChildLocked(item))
|
&& item->parentGroup()->isChildLocked(item))
|
||||||
if(!indices.contains(item_id(item->parentGroup())))
|
if(!indices.contains(item_id(item->parentGroup())))
|
||||||
continue;
|
continue;
|
||||||
|
Scene_group_item* group = qobject_cast<Scene_group_item*>(item);
|
||||||
|
if(group)
|
||||||
|
{
|
||||||
|
Q_FOREACH(Scene_item* child, group->getChildren())
|
||||||
|
{
|
||||||
|
if(!to_be_removed.contains(child))
|
||||||
|
to_be_removed.push_back(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
if(!to_be_removed.contains(item))
|
if(!to_be_removed.contains(item))
|
||||||
to_be_removed.push_back(item);
|
to_be_removed.push_back(item);
|
||||||
}
|
}
|
||||||
|
|
@ -781,6 +790,10 @@ Scene::setData(const QModelIndex &index,
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
case ColorColumn:
|
case ColorColumn:
|
||||||
|
if(!selectionIndices().empty())
|
||||||
|
Q_FOREACH(Item_id item_index, selectionIndices())
|
||||||
|
this->item(item_index)->setColor(value.value<QColor>());
|
||||||
|
else
|
||||||
item->setColor(value.value<QColor>());
|
item->setColor(value.value<QColor>());
|
||||||
Q_EMIT dataChanged(index, index);
|
Q_EMIT dataChanged(index, index);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ public Q_SLOTS:
|
||||||
if(group)
|
if(group)
|
||||||
{
|
{
|
||||||
QList<int> list;
|
QList<int> list;
|
||||||
Q_FOREACH(CGAL::Three::Scene_item* child, group->getChildren())
|
Q_FOREACH(CGAL::Three::Scene_item* child, group->getChildrenForSelection())
|
||||||
list<<m_entries.indexOf(child);
|
list<<m_entries.indexOf(child);
|
||||||
l << setSelectedItemsList(list);
|
l << setSelectedItemsList(list);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ public :
|
||||||
{
|
{
|
||||||
setParent(parent);
|
setParent(parent);
|
||||||
}
|
}
|
||||||
|
bool isFinite() const { return false; }
|
||||||
void init_vectors(
|
void init_vectors(
|
||||||
std::vector<float> *p_vertices,
|
std::vector<float> *p_vertices,
|
||||||
std::vector<float> *p_normals,
|
std::vector<float> *p_normals,
|
||||||
|
|
@ -298,7 +299,6 @@ struct Scene_c3t3_item_priv {
|
||||||
tree.clear();
|
tree.clear();
|
||||||
if(frame)
|
if(frame)
|
||||||
{
|
{
|
||||||
static_cast<CGAL::Three::Viewer_interface*>(QGLViewer::QGLViewerPool().first())->setManipulatedFrame(0);
|
|
||||||
delete frame;
|
delete frame;
|
||||||
frame = NULL;
|
frame = NULL;
|
||||||
delete tet_Slider;
|
delete tet_Slider;
|
||||||
|
|
@ -317,7 +317,7 @@ struct Scene_c3t3_item_priv {
|
||||||
intersection = NULL;
|
intersection = NULL;
|
||||||
spheres_are_shown = false;
|
spheres_are_shown = false;
|
||||||
cnc_are_shown = false;
|
cnc_are_shown = false;
|
||||||
show_tetrahedra = false;
|
show_tetrahedra = true;
|
||||||
is_aabb_tree_built = false;
|
is_aabb_tree_built = false;
|
||||||
are_intersection_buffers_filled = false;
|
are_intersection_buffers_filled = false;
|
||||||
is_grid_shown = true;
|
is_grid_shown = true;
|
||||||
|
|
@ -915,6 +915,7 @@ void Scene_c3t3_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
vaos[Scene_c3t3_item_priv::Facets]->release();
|
vaos[Scene_c3t3_item_priv::Facets]->release();
|
||||||
|
|
||||||
if(d->show_tetrahedra){
|
if(d->show_tetrahedra){
|
||||||
|
ncthis->show_intersection(true);
|
||||||
if(!d->frame->isManipulated())
|
if(!d->frame->isManipulated())
|
||||||
d->intersection->setFast(false);
|
d->intersection->setFast(false);
|
||||||
else
|
else
|
||||||
|
|
@ -925,6 +926,7 @@ void Scene_c3t3_item::draw(CGAL::Three::Viewer_interface* viewer) const {
|
||||||
ncthis->d->computeIntersections();
|
ncthis->d->computeIntersections();
|
||||||
d->intersection->initialize_buffers(viewer);
|
d->intersection->initialize_buffers(viewer);
|
||||||
d->are_intersection_buffers_filled = true;
|
d->are_intersection_buffers_filled = true;
|
||||||
|
ncthis->show_intersection(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1829,7 +1831,7 @@ bool Scene_c3t3_item::keyPressEvent(QKeyEvent *event)
|
||||||
d->tet_Slider->setValue(d->tet_Slider->value() -5);
|
d->tet_Slider->setValue(d->tet_Slider->value() -5);
|
||||||
itemChanged();
|
itemChanged();
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Scene_c3t3_item::computeStats(int type)
|
QString Scene_c3t3_item::computeStats(int type)
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,8 @@ public:
|
||||||
void draw(CGAL::Three::Viewer_interface* viewer) const Q_DECL_OVERRIDE;
|
void draw(CGAL::Three::Viewer_interface* viewer) const Q_DECL_OVERRIDE;
|
||||||
void drawEdges(CGAL::Three::Viewer_interface* viewer) const Q_DECL_OVERRIDE;
|
void drawEdges(CGAL::Three::Viewer_interface* viewer) const Q_DECL_OVERRIDE;
|
||||||
void drawPoints(CGAL::Three::Viewer_interface * viewer) const Q_DECL_OVERRIDE;
|
void drawPoints(CGAL::Three::Viewer_interface * viewer) const Q_DECL_OVERRIDE;
|
||||||
|
//When selecting a c3t3 item, we don't want to select its children, so we can still apply Operations to it
|
||||||
|
QList<Scene_item*> getChildrenForSelection() const Q_DECL_OVERRIDE { return QList<Scene_item*>(); }
|
||||||
public:
|
public:
|
||||||
QMenu* contextMenu() Q_DECL_OVERRIDE;
|
QMenu* contextMenu() Q_DECL_OVERRIDE;
|
||||||
void copyProperties(Scene_item *) Q_DECL_OVERRIDE;
|
void copyProperties(Scene_item *) Q_DECL_OVERRIDE;
|
||||||
|
|
|
||||||
|
|
@ -123,10 +123,6 @@ QMenu* CGAL::Three::Scene_item::contextMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultContextMenu = new QMenu(name());
|
defaultContextMenu = new QMenu(name());
|
||||||
// defaultContextMenu->addAction(name());
|
|
||||||
// defaultContextMenu->addSeparator();
|
|
||||||
// QMenu* modeMenu = new QMenu(QObject::tr("Rendering mode"),
|
|
||||||
// defaultContextMenu);
|
|
||||||
for(unsigned int mode = 0; mode < NumberOfRenderingMode;
|
for(unsigned int mode = 0; mode < NumberOfRenderingMode;
|
||||||
++mode)
|
++mode)
|
||||||
{
|
{
|
||||||
|
|
@ -136,8 +132,8 @@ QMenu* CGAL::Three::Scene_item::contextMenu()
|
||||||
.arg(mName),
|
.arg(mName),
|
||||||
this,
|
this,
|
||||||
slotName(RenderingMode(mode)));
|
slotName(RenderingMode(mode)));
|
||||||
|
defaultContextMenu->actions().last()->setProperty("is_groupable", true);
|
||||||
}
|
}
|
||||||
// defaultContextMenu->addAction(modeMenu->menuAction());
|
|
||||||
return defaultContextMenu;
|
return defaultContextMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,10 @@ Scene_points_with_normal_item::Scene_points_with_normal_item(const Scene_points_
|
||||||
setRenderingMode(Points);
|
setRenderingMode(Points);
|
||||||
is_selected = true;
|
is_selected = true;
|
||||||
}
|
}
|
||||||
|
if(d->m_points->number_of_points() < 30 )
|
||||||
|
d->point_Slider->setValue(5);
|
||||||
|
else
|
||||||
|
d->point_Slider->setValue(2);
|
||||||
invalidateOpenGLBuffers();
|
invalidateOpenGLBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -182,6 +185,10 @@ Scene_points_with_normal_item::Scene_points_with_normal_item(const SMesh& input_
|
||||||
d = new Scene_points_with_normal_item_priv(input_mesh, this);
|
d = new Scene_points_with_normal_item_priv(input_mesh, this);
|
||||||
setRenderingMode(PointsPlusNormals);
|
setRenderingMode(PointsPlusNormals);
|
||||||
is_selected = true;
|
is_selected = true;
|
||||||
|
if(d->m_points->number_of_points() < 30 )
|
||||||
|
d->point_Slider->setValue(5);
|
||||||
|
else
|
||||||
|
d->point_Slider->setValue(2);
|
||||||
invalidateOpenGLBuffers();
|
invalidateOpenGLBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,6 +200,10 @@ Scene_points_with_normal_item::Scene_points_with_normal_item(const Polyhedron& i
|
||||||
d = new Scene_points_with_normal_item_priv(input_mesh, this);
|
d = new Scene_points_with_normal_item_priv(input_mesh, this);
|
||||||
setRenderingMode(PointsPlusNormals);
|
setRenderingMode(PointsPlusNormals);
|
||||||
is_selected = true;
|
is_selected = true;
|
||||||
|
if(d->m_points->number_of_points() < 30 )
|
||||||
|
d->point_Slider->setValue(5);
|
||||||
|
else
|
||||||
|
d->point_Slider->setValue(2);
|
||||||
invalidateOpenGLBuffers();
|
invalidateOpenGLBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -369,10 +380,6 @@ void Scene_points_with_normal_item_priv::compute_normals_and_vertices() const
|
||||||
normals.resize(0);
|
normals.resize(0);
|
||||||
colors_points.resize(0);
|
colors_points.resize(0);
|
||||||
|
|
||||||
if(item->point_set()->number_of_points() < 30 )
|
|
||||||
point_Slider->setValue(5);
|
|
||||||
else
|
|
||||||
point_Slider->setValue(2);
|
|
||||||
//Shuffle container to allow quick display random points
|
//Shuffle container to allow quick display random points
|
||||||
std::random_shuffle (m_points->begin(), m_points->first_selected());
|
std::random_shuffle (m_points->begin(), m_points->first_selected());
|
||||||
if (m_points->nb_selected_points() != 0)
|
if (m_points->nb_selected_points() != 0)
|
||||||
|
|
@ -594,7 +601,10 @@ bool Scene_points_with_normal_item::read_ply_point_set(std::istream& stream)
|
||||||
bool ok = stream &&
|
bool ok = stream &&
|
||||||
CGAL::read_ply_point_set (stream, *(d->m_points), &(d->m_comments)) &&
|
CGAL::read_ply_point_set (stream, *(d->m_points), &(d->m_comments)) &&
|
||||||
!isEmpty();
|
!isEmpty();
|
||||||
|
if(d->m_points->number_of_points() < 30 )
|
||||||
|
d->point_Slider->setValue(5);
|
||||||
|
else
|
||||||
|
d->point_Slider->setValue(2);
|
||||||
std::cerr << d->m_points->info();
|
std::cerr << d->m_points->info();
|
||||||
|
|
||||||
if (d->m_points->has_normal_map())
|
if (d->m_points->has_normal_map())
|
||||||
|
|
@ -637,6 +647,10 @@ bool Scene_points_with_normal_item::read_off_point_set(std::istream& stream)
|
||||||
bool ok = stream &&
|
bool ok = stream &&
|
||||||
CGAL::read_off_point_set(stream, *(d->m_points)) &&
|
CGAL::read_off_point_set(stream, *(d->m_points)) &&
|
||||||
!isEmpty();
|
!isEmpty();
|
||||||
|
if(d->m_points->number_of_points() < 30 )
|
||||||
|
d->point_Slider->setValue(5);
|
||||||
|
else
|
||||||
|
d->point_Slider->setValue(2);
|
||||||
invalidateOpenGLBuffers();
|
invalidateOpenGLBuffers();
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
@ -662,7 +676,10 @@ bool Scene_points_with_normal_item::read_xyz_point_set(std::istream& stream)
|
||||||
bool ok = stream &&
|
bool ok = stream &&
|
||||||
CGAL::read_xyz_point_set (stream, *(d->m_points)) &&
|
CGAL::read_xyz_point_set (stream, *(d->m_points)) &&
|
||||||
!isEmpty();
|
!isEmpty();
|
||||||
|
if(d->m_points->number_of_points() < 30 )
|
||||||
|
d->point_Slider->setValue(5);
|
||||||
|
else
|
||||||
|
d->point_Slider->setValue(2);
|
||||||
invalidateOpenGLBuffers();
|
invalidateOpenGLBuffers();
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
@ -1004,7 +1021,8 @@ void Scene_points_with_normal_item::copyProperties(Scene_item *item)
|
||||||
Scene_points_with_normal_item* point_item = qobject_cast<Scene_points_with_normal_item*>(item);
|
Scene_points_with_normal_item* point_item = qobject_cast<Scene_points_with_normal_item*>(item);
|
||||||
if(!point_item)
|
if(!point_item)
|
||||||
return;
|
return;
|
||||||
d->point_Slider->setValue(point_item->getPointSliderValue());
|
int value = point_item->getPointSliderValue();
|
||||||
|
setPointSize(value);
|
||||||
if(has_normals())
|
if(has_normals())
|
||||||
d->normal_Slider->setValue(point_item->getNormalSliderValue());
|
d->normal_Slider->setValue(point_item->getNormalSliderValue());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,10 +121,9 @@ struct Scene_polyhedron_item_priv{
|
||||||
nb_f_lines = 0;
|
nb_f_lines = 0;
|
||||||
is_multicolor = false;
|
is_multicolor = false;
|
||||||
no_flat = false;
|
no_flat = false;
|
||||||
vertices_displayed = true;
|
vertices_displayed = false;
|
||||||
edges_displayed = true;
|
edges_displayed = false;
|
||||||
faces_displayed = true;
|
faces_displayed = false;
|
||||||
all_primitives_displayed = false;
|
|
||||||
invalidate_stats();
|
invalidate_stats();
|
||||||
CGAL::set_halfedgeds_items_id(*poly);
|
CGAL::set_halfedgeds_items_id(*poly);
|
||||||
}
|
}
|
||||||
|
|
@ -189,7 +188,6 @@ struct Scene_polyhedron_item_priv{
|
||||||
mutable bool vertices_displayed;
|
mutable bool vertices_displayed;
|
||||||
mutable bool edges_displayed;
|
mutable bool edges_displayed;
|
||||||
mutable bool faces_displayed;
|
mutable bool faces_displayed;
|
||||||
mutable bool all_primitives_displayed;
|
|
||||||
mutable QList<double> text_ids;
|
mutable QList<double> text_ids;
|
||||||
mutable std::vector<TextItem*> targeted_id;
|
mutable std::vector<TextItem*> targeted_id;
|
||||||
void initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const;
|
void initialize_buffers(CGAL::Three::Viewer_interface *viewer = 0) const;
|
||||||
|
|
@ -1078,7 +1076,7 @@ Scene_polyhedron_item::toolTip() const
|
||||||
QObject::tr("<p>Polyhedron_3 <b>%1</b> (mode: %5, color: %6)</p>"
|
QObject::tr("<p>Polyhedron_3 <b>%1</b> (mode: %5, color: %6)</p>"
|
||||||
"<p>Number of vertices: %2<br />"
|
"<p>Number of vertices: %2<br />"
|
||||||
"Number of edges: %3<br />"
|
"Number of edges: %3<br />"
|
||||||
"Number of facets: %4")
|
"Number of faces: %4")
|
||||||
.arg(this->name())
|
.arg(this->name())
|
||||||
.arg(d->poly->size_of_vertices())
|
.arg(d->poly->size_of_vertices())
|
||||||
.arg(d->poly->size_of_halfedges()/2)
|
.arg(d->poly->size_of_halfedges()/2)
|
||||||
|
|
@ -1142,13 +1140,6 @@ QMenu* Scene_polyhedron_item::contextMenu()
|
||||||
connect(actionPrintFaces, SIGNAL(triggered(bool)),
|
connect(actionPrintFaces, SIGNAL(triggered(bool)),
|
||||||
this, SLOT(showFaces(bool)));
|
this, SLOT(showFaces(bool)));
|
||||||
|
|
||||||
QAction* actionPrintAll=
|
|
||||||
menu->addAction(tr("Display All Ids"));
|
|
||||||
actionPrintAll->setCheckable(true);
|
|
||||||
actionPrintAll->setObjectName("actionPrintAll");
|
|
||||||
connect(actionPrintAll, SIGNAL(triggered(bool)),
|
|
||||||
this, SLOT(showPrimitives(bool)));
|
|
||||||
|
|
||||||
QAction* actionZoomToId=
|
QAction* actionZoomToId=
|
||||||
menu->addAction(tr("Zoom to Index"));
|
menu->addAction(tr("Zoom to Index"));
|
||||||
actionZoomToId->setObjectName("actionZoomToId");
|
actionZoomToId->setObjectName("actionZoomToId");
|
||||||
|
|
@ -1212,8 +1203,6 @@ QMenu* Scene_polyhedron_item::contextMenu()
|
||||||
if(action) action->setChecked(d->edges_displayed);
|
if(action) action->setChecked(d->edges_displayed);
|
||||||
action = menu->findChild<QAction*>("actionPrintFaces");
|
action = menu->findChild<QAction*>("actionPrintFaces");
|
||||||
if(action) action->setChecked(d->faces_displayed);
|
if(action) action->setChecked(d->faces_displayed);
|
||||||
action = menu->findChild<QAction*>("actionPrintAll");
|
|
||||||
if(action) action->setChecked(d->all_primitives_displayed);
|
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
@ -1845,8 +1834,6 @@ CGAL::Three::Scene_item::Header_data Scene_polyhedron_item::header() const
|
||||||
|
|
||||||
void Scene_polyhedron_item::printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface *viewer)
|
void Scene_polyhedron_item::printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface *viewer)
|
||||||
{
|
{
|
||||||
if(d->all_primitives_displayed)
|
|
||||||
return;
|
|
||||||
typedef Input_facets_AABB_tree Tree;
|
typedef Input_facets_AABB_tree Tree;
|
||||||
Tree* aabb_tree = static_cast<Input_facets_AABB_tree*>(d->get_aabb_tree());
|
Tree* aabb_tree = static_cast<Input_facets_AABB_tree*>(d->get_aabb_tree());
|
||||||
if(!aabb_tree)
|
if(!aabb_tree)
|
||||||
|
|
@ -1871,8 +1858,7 @@ void Scene_polyhedron_item_priv::fillTargetedIds(const Polyhedron::Facet_handle&
|
||||||
textVItems,
|
textVItems,
|
||||||
textEItems,
|
textEItems,
|
||||||
textFItems,
|
textFItems,
|
||||||
&targeted_id,
|
&targeted_id);
|
||||||
&all_primitives_displayed);
|
|
||||||
|
|
||||||
|
|
||||||
if(vertices_displayed
|
if(vertices_displayed
|
||||||
|
|
@ -1928,8 +1914,7 @@ void Scene_polyhedron_item_priv::killIds()
|
||||||
textVItems,
|
textVItems,
|
||||||
textEItems,
|
textEItems,
|
||||||
textFItems,
|
textFItems,
|
||||||
&targeted_id,
|
&targeted_id);
|
||||||
&all_primitives_displayed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_polyhedron_item::printAllIds(CGAL::Three::Viewer_interface *viewer)
|
void Scene_polyhedron_item::printAllIds(CGAL::Three::Viewer_interface *viewer)
|
||||||
|
|
@ -1944,7 +1929,6 @@ void Scene_polyhedron_item::printAllIds(CGAL::Three::Viewer_interface *viewer)
|
||||||
s3(printFaceIds(viewer));
|
s3(printFaceIds(viewer));
|
||||||
if((s1 && s2 && s3))
|
if((s1 && s2 && s3))
|
||||||
{
|
{
|
||||||
d->all_primitives_displayed = true;
|
|
||||||
viewer->update();
|
viewer->update();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
@ -2251,6 +2235,9 @@ void Scene_polyhedron_item::zoomToId()
|
||||||
QString text = QInputDialog::getText(QApplication::activeWindow(), tr("Zoom to Index"),
|
QString text = QInputDialog::getText(QApplication::activeWindow(), tr("Zoom to Index"),
|
||||||
tr("Simplex"), QLineEdit::Normal,
|
tr("Simplex"), QLineEdit::Normal,
|
||||||
tr("v0"), &ok);
|
tr("v0"), &ok);
|
||||||
|
if(!ok)
|
||||||
|
return;
|
||||||
|
|
||||||
CGAL::Three::Viewer_interface* viewer =
|
CGAL::Three::Viewer_interface* viewer =
|
||||||
qobject_cast<CGAL::Three::Viewer_interface*>(QGLViewer::QGLViewerPool().first());
|
qobject_cast<CGAL::Three::Viewer_interface*>(QGLViewer::QGLViewerPool().first());
|
||||||
Point p;
|
Point p;
|
||||||
|
|
|
||||||
|
|
@ -88,10 +88,9 @@ struct Scene_surface_mesh_item_priv{
|
||||||
item = parent;
|
item = parent;
|
||||||
has_feature_edges = false;
|
has_feature_edges = false;
|
||||||
invalidate_stats();
|
invalidate_stats();
|
||||||
vertices_displayed = true;
|
vertices_displayed = false;
|
||||||
edges_displayed = true;
|
edges_displayed = false;
|
||||||
faces_displayed = true;
|
faces_displayed = false;
|
||||||
all_primitives_displayed = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Scene_surface_mesh_item_priv(SMesh* sm, Scene_surface_mesh_item *parent):
|
Scene_surface_mesh_item_priv(SMesh* sm, Scene_surface_mesh_item *parent):
|
||||||
|
|
@ -100,10 +99,9 @@ struct Scene_surface_mesh_item_priv{
|
||||||
item = parent;
|
item = parent;
|
||||||
has_feature_edges = false;
|
has_feature_edges = false;
|
||||||
invalidate_stats();
|
invalidate_stats();
|
||||||
vertices_displayed = true;
|
vertices_displayed = false;
|
||||||
edges_displayed = true;
|
edges_displayed = false;
|
||||||
faces_displayed = true;
|
faces_displayed = false;
|
||||||
all_primitives_displayed = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~Scene_surface_mesh_item_priv()
|
~Scene_surface_mesh_item_priv()
|
||||||
|
|
@ -165,7 +163,6 @@ struct Scene_surface_mesh_item_priv{
|
||||||
mutable bool vertices_displayed;
|
mutable bool vertices_displayed;
|
||||||
mutable bool edges_displayed;
|
mutable bool edges_displayed;
|
||||||
mutable bool faces_displayed;
|
mutable bool faces_displayed;
|
||||||
mutable bool all_primitives_displayed;
|
|
||||||
mutable QList<double> text_ids;
|
mutable QList<double> text_ids;
|
||||||
mutable std::vector<TextItem*> targeted_id;
|
mutable std::vector<TextItem*> targeted_id;
|
||||||
|
|
||||||
|
|
@ -774,7 +771,7 @@ Scene_surface_mesh_item::isEmpty() const
|
||||||
|
|
||||||
QString Scene_surface_mesh_item::toolTip() const
|
QString Scene_surface_mesh_item::toolTip() const
|
||||||
{
|
{
|
||||||
return QObject::tr("<p>Surface_mesh <b>%1</b> (mode: %5, color: %6)</p>"
|
QString str = QObject::tr("<p>Surface_mesh <b>%1</b> (mode: %5, color: %6)</p>"
|
||||||
"<p>Number of vertices: %2<br />"
|
"<p>Number of vertices: %2<br />"
|
||||||
"Number of edges: %3<br />"
|
"Number of edges: %3<br />"
|
||||||
"Number of faces: %4</p>")
|
"Number of faces: %4</p>")
|
||||||
|
|
@ -784,6 +781,8 @@ QString Scene_surface_mesh_item::toolTip() const
|
||||||
.arg(num_faces(*d->smesh_))
|
.arg(num_faces(*d->smesh_))
|
||||||
.arg(this->renderingModeName())
|
.arg(this->renderingModeName())
|
||||||
.arg(this->color().name());
|
.arg(this->color().name());
|
||||||
|
str += QString("<br />Number of isolated vertices: %1<br />").arg(getNbIsolatedvertices());
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_surface_mesh_item_priv::checkFloat()const
|
void Scene_surface_mesh_item_priv::checkFloat()const
|
||||||
|
|
@ -1706,12 +1705,6 @@ QMenu* Scene_surface_mesh_item::contextMenu()
|
||||||
connect(actionPrintFaces, SIGNAL(triggered(bool)),
|
connect(actionPrintFaces, SIGNAL(triggered(bool)),
|
||||||
this, SLOT(showFaces(bool)));
|
this, SLOT(showFaces(bool)));
|
||||||
|
|
||||||
QAction* actionPrintAll=
|
|
||||||
menu->addAction(tr("Display All Ids"));
|
|
||||||
actionPrintAll->setCheckable(true);
|
|
||||||
actionPrintAll->setObjectName("actionPrintAll");
|
|
||||||
connect(actionPrintAll, SIGNAL(triggered(bool)),
|
|
||||||
this, SLOT(showPrimitives(bool)));
|
|
||||||
|
|
||||||
QAction* actionZoomToId=
|
QAction* actionZoomToId=
|
||||||
menu->addAction(tr("Zoom to Index"));
|
menu->addAction(tr("Zoom to Index"));
|
||||||
|
|
@ -1727,14 +1720,10 @@ QMenu* Scene_surface_mesh_item::contextMenu()
|
||||||
if(action) action->setChecked(d->edges_displayed);
|
if(action) action->setChecked(d->edges_displayed);
|
||||||
action = menu->findChild<QAction*>("actionPrintFaces");
|
action = menu->findChild<QAction*>("actionPrintFaces");
|
||||||
if(action) action->setChecked(d->faces_displayed);
|
if(action) action->setChecked(d->faces_displayed);
|
||||||
action = menu->findChild<QAction*>("actionPrintAll");
|
|
||||||
if(action) action->setChecked(d->all_primitives_displayed);
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
void Scene_surface_mesh_item::printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface *viewer)
|
void Scene_surface_mesh_item::printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface *viewer)
|
||||||
{
|
{
|
||||||
if(d->all_primitives_displayed)
|
|
||||||
return;
|
|
||||||
typedef Input_facets_AABB_tree Tree;
|
typedef Input_facets_AABB_tree Tree;
|
||||||
Tree* aabb_tree = static_cast<Input_facets_AABB_tree*>(d->get_aabb_tree());
|
Tree* aabb_tree = static_cast<Input_facets_AABB_tree*>(d->get_aabb_tree());
|
||||||
if(!aabb_tree)
|
if(!aabb_tree)
|
||||||
|
|
@ -1759,8 +1748,7 @@ void Scene_surface_mesh_item_priv::fillTargetedIds(const face_descriptor &select
|
||||||
textVItems,
|
textVItems,
|
||||||
textEItems,
|
textEItems,
|
||||||
textFItems,
|
textFItems,
|
||||||
&targeted_id,
|
&targeted_id);
|
||||||
&all_primitives_displayed);
|
|
||||||
|
|
||||||
|
|
||||||
if(vertices_displayed
|
if(vertices_displayed
|
||||||
|
|
@ -1816,8 +1804,7 @@ void Scene_surface_mesh_item_priv::killIds()
|
||||||
textVItems,
|
textVItems,
|
||||||
textEItems,
|
textEItems,
|
||||||
textFItems,
|
textFItems,
|
||||||
&targeted_id,
|
&targeted_id);
|
||||||
&all_primitives_displayed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_surface_mesh_item::printAllIds(CGAL::Three::Viewer_interface *viewer)
|
void Scene_surface_mesh_item::printAllIds(CGAL::Three::Viewer_interface *viewer)
|
||||||
|
|
@ -1832,7 +1819,6 @@ void Scene_surface_mesh_item::printAllIds(CGAL::Three::Viewer_interface *viewer)
|
||||||
s3(printFaceIds(viewer));
|
s3(printFaceIds(viewer));
|
||||||
if((s1 && s2 && s3))
|
if((s1 && s2 && s3))
|
||||||
{
|
{
|
||||||
d->all_primitives_displayed = true;
|
|
||||||
viewer->update();
|
viewer->update();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
@ -1887,7 +1873,7 @@ void Scene_surface_mesh_item::showEdges(bool b)
|
||||||
if(d->textEItems->isEmpty())
|
if(d->textEItems->isEmpty())
|
||||||
{
|
{
|
||||||
d->edges_displayed = b;
|
d->edges_displayed = b;
|
||||||
printFaceIds(viewer);
|
printEdgeIds(viewer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
renderer->addTextList(d->textEItems);
|
renderer->addTextList(d->textEItems);
|
||||||
|
|
@ -1932,6 +1918,9 @@ void Scene_surface_mesh_item::zoomToId()
|
||||||
QString text = QInputDialog::getText(QApplication::activeWindow(), tr("Zoom to Index"),
|
QString text = QInputDialog::getText(QApplication::activeWindow(), tr("Zoom to Index"),
|
||||||
tr("Simplex"), QLineEdit::Normal,
|
tr("Simplex"), QLineEdit::Normal,
|
||||||
tr("v0"), &ok);
|
tr("v0"), &ok);
|
||||||
|
if(!ok)
|
||||||
|
return;
|
||||||
|
|
||||||
CGAL::Three::Viewer_interface* viewer =
|
CGAL::Three::Viewer_interface* viewer =
|
||||||
qobject_cast<CGAL::Three::Viewer_interface*>(QGLViewer::QGLViewerPool().first());
|
qobject_cast<CGAL::Three::Viewer_interface*>(QGLViewer::QGLViewerPool().first());
|
||||||
Point_3 p;
|
Point_3 p;
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,9 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
//! The buffers used to draw the axis system
|
//! The buffers used to draw the axis system
|
||||||
QOpenGLBuffer buffers[4];
|
QOpenGLBuffer buffers[8];
|
||||||
//! The VAO used to draw the axis system
|
//! The VAO used to draw the axis system
|
||||||
QOpenGLVertexArrayObject vao[2];
|
QOpenGLVertexArrayObject vao[4];
|
||||||
//! The rendering program used to draw the axis system
|
//! The rendering program used to draw the axis system
|
||||||
QOpenGLShaderProgram rendering_program;
|
QOpenGLShaderProgram rendering_program;
|
||||||
//! The rendering program used to draw the distance
|
//! The rendering program used to draw the distance
|
||||||
|
|
@ -69,6 +69,9 @@ public:
|
||||||
std::vector<float> c_Axis;
|
std::vector<float> c_Axis;
|
||||||
//! Decides if the axis system must be drawn or not
|
//! Decides if the axis system must be drawn or not
|
||||||
bool axis_are_displayed;
|
bool axis_are_displayed;
|
||||||
|
bool grid_is_displayed;
|
||||||
|
std::size_t grid_size;
|
||||||
|
std::size_t v_gaxis_size;
|
||||||
//! Decides if the text is displayed in the drawVisualHints function.
|
//! Decides if the text is displayed in the drawVisualHints function.
|
||||||
bool has_text;
|
bool has_text;
|
||||||
//! Decides if the distance between APoint and BPoint must be drawn;
|
//! Decides if the distance between APoint and BPoint must be drawn;
|
||||||
|
|
@ -96,6 +99,7 @@ public:
|
||||||
* \param data the struct of std::vector that will contain the results.
|
* \param data the struct of std::vector that will contain the results.
|
||||||
*/
|
*/
|
||||||
void makeArrow(double R, int prec, qglviewer::Vec from, qglviewer::Vec to, qglviewer::Vec color, AxisData &data);
|
void makeArrow(double R, int prec, qglviewer::Vec from, qglviewer::Vec to, qglviewer::Vec color, AxisData &data);
|
||||||
|
void drawGrid(qreal size, int nbSubdivisions=10);
|
||||||
//!Clears the distance display
|
//!Clears the distance display
|
||||||
void clearDistancedisplay();
|
void clearDistancedisplay();
|
||||||
void draw_aux(bool with_names, Viewer*);
|
void draw_aux(bool with_names, Viewer*);
|
||||||
|
|
@ -138,6 +142,8 @@ Viewer::Viewer(QWidget* parent, bool antialiasing)
|
||||||
tr("Toggle the primitive IDs visibility of the selected Item."));
|
tr("Toggle the primitive IDs visibility of the selected Item."));
|
||||||
setKeyDescription(Qt::Key_D,
|
setKeyDescription(Qt::Key_D,
|
||||||
tr("Disable the distance between two points visibility."));
|
tr("Disable the distance between two points visibility."));
|
||||||
|
setKeyDescription(Qt::Key_F5,
|
||||||
|
tr("Reload selected items if possible."));
|
||||||
|
|
||||||
#if QGLVIEWER_VERSION >= 0x020501
|
#if QGLVIEWER_VERSION >= 0x020501
|
||||||
//modify mouse bindings that have been updated
|
//modify mouse bindings that have been updated
|
||||||
|
|
@ -168,6 +174,8 @@ Viewer::Viewer(QWidget* parent, bool antialiasing)
|
||||||
#endif // QGLVIEWER_VERSION >= 2.5.0
|
#endif // QGLVIEWER_VERSION >= 2.5.0
|
||||||
prev_radius = sceneRadius();
|
prev_radius = sceneRadius();
|
||||||
d->axis_are_displayed = true;
|
d->axis_are_displayed = true;
|
||||||
|
d->grid_is_displayed = false;
|
||||||
|
d->grid_size = 0;
|
||||||
d->has_text = false;
|
d->has_text = false;
|
||||||
d->i_is_pressed = false;
|
d->i_is_pressed = false;
|
||||||
d->z_is_pressed = false;
|
d->z_is_pressed = false;
|
||||||
|
|
@ -398,6 +406,12 @@ void Viewer::initializeGL()
|
||||||
{
|
{
|
||||||
d->vao[1].create();
|
d->vao[1].create();
|
||||||
d->buffers[3].create();
|
d->buffers[3].create();
|
||||||
|
d->vao[2].create();
|
||||||
|
d->vao[3].create();
|
||||||
|
d->buffers[4].create();
|
||||||
|
d->buffers[5].create();
|
||||||
|
d->buffers[6].create();
|
||||||
|
d->buffers[7].create();
|
||||||
//Vertex source code
|
//Vertex source code
|
||||||
const char vertex_source_dist[] =
|
const char vertex_source_dist[] =
|
||||||
{
|
{
|
||||||
|
|
@ -557,6 +571,10 @@ void Viewer::keyPressEvent(QKeyEvent* e)
|
||||||
d->axis_are_displayed = !d->axis_are_displayed;
|
d->axis_are_displayed = !d->axis_are_displayed;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
else if(e->key() == Qt::Key_G) {
|
||||||
|
d->grid_is_displayed = !d->grid_is_displayed;
|
||||||
|
update();
|
||||||
|
}
|
||||||
else if(e->key() == Qt::Key_I) {
|
else if(e->key() == Qt::Key_I) {
|
||||||
d->i_is_pressed = true;
|
d->i_is_pressed = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1141,6 +1159,71 @@ void Viewer::drawVisualHints()
|
||||||
glLineWidth(1.0f);
|
glLineWidth(1.0f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if(d->grid_is_displayed)
|
||||||
|
{
|
||||||
|
//draws the distance
|
||||||
|
QMatrix4x4 mvpMatrix;
|
||||||
|
double mat[16];
|
||||||
|
//camera()->frame()->rotation().getMatrix(mat);
|
||||||
|
camera()->getModelViewProjectionMatrix(mat);
|
||||||
|
//nullifies the translation
|
||||||
|
for(int i=0; i < 16; i++)
|
||||||
|
{
|
||||||
|
mvpMatrix.data()[i] = (float)mat[i];
|
||||||
|
}
|
||||||
|
d->rendering_program_dist.bind();
|
||||||
|
d->rendering_program_dist.setUniformValue("mvp_matrix", mvpMatrix);
|
||||||
|
d->vao[2].bind();
|
||||||
|
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(d->grid_size));
|
||||||
|
d->vao[2].release();
|
||||||
|
d->rendering_program_dist.release();
|
||||||
|
|
||||||
|
d->rendering_program.bind();
|
||||||
|
QMatrix4x4 mvMatrix;
|
||||||
|
for(int i=0; i < 16; i++)
|
||||||
|
{
|
||||||
|
mvMatrix.data()[i] = camera()->orientation().inverse().matrix()[i];
|
||||||
|
}
|
||||||
|
QVector4D position(0.0f,0.0f,1.0f,1.0f );
|
||||||
|
// define material
|
||||||
|
QVector4D ambient;
|
||||||
|
QVector4D diffuse;
|
||||||
|
QVector4D specular;
|
||||||
|
GLfloat shininess ;
|
||||||
|
// Ambient
|
||||||
|
ambient[0] = 0.29225f;
|
||||||
|
ambient[1] = 0.29225f;
|
||||||
|
ambient[2] = 0.29225f;
|
||||||
|
ambient[3] = 1.0f;
|
||||||
|
// Diffuse
|
||||||
|
diffuse[0] = 0.50754f;
|
||||||
|
diffuse[1] = 0.50754f;
|
||||||
|
diffuse[2] = 0.50754f;
|
||||||
|
diffuse[3] = 1.0f;
|
||||||
|
// Specular
|
||||||
|
specular[0] = 0.0f;
|
||||||
|
specular[1] = 0.0f;
|
||||||
|
specular[2] = 0.0f;
|
||||||
|
specular[3] = 0.0f;
|
||||||
|
// Shininess
|
||||||
|
shininess = 51.2f;
|
||||||
|
|
||||||
|
d->rendering_program.setUniformValue("light_pos", position);
|
||||||
|
d->rendering_program.setUniformValue("mvp_matrix", mvpMatrix);
|
||||||
|
d->rendering_program.setUniformValue("mv_matrix", mvMatrix);
|
||||||
|
d->rendering_program.setUniformValue("light_diff", diffuse);
|
||||||
|
d->rendering_program.setUniformValue("light_spec", specular);
|
||||||
|
d->rendering_program.setUniformValue("light_amb", ambient);
|
||||||
|
d->rendering_program.setUniformValue("spec_power", shininess);
|
||||||
|
|
||||||
|
d->vao[3].bind();
|
||||||
|
// Axis viewport size, in pixels
|
||||||
|
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(d->v_gaxis_size / 3));
|
||||||
|
// The viewport and the scissor are restored.
|
||||||
|
d->vao[3].release();
|
||||||
|
d->rendering_program.release();
|
||||||
|
}
|
||||||
|
|
||||||
if (!d->painter->isActive())
|
if (!d->painter->isActive())
|
||||||
d->painter->begin(this);
|
d->painter->begin(this);
|
||||||
//So that the text is drawn in front of everything
|
//So that the text is drawn in front of everything
|
||||||
|
|
@ -1325,9 +1408,6 @@ void Viewer::postDraw()
|
||||||
// Pivot point, line when camera rolls, zoom region
|
// Pivot point, line when camera rolls, zoom region
|
||||||
drawVisualHints();
|
drawVisualHints();
|
||||||
|
|
||||||
if (gridIsDrawn()) { glLineWidth(1.0); drawGrid(camera()->sceneRadius()); }
|
|
||||||
if (axisIsDrawn()) { glLineWidth(2.0); drawAxis(camera()->sceneRadius()); }
|
|
||||||
|
|
||||||
// FPS computation
|
// FPS computation
|
||||||
const unsigned int maxCounter = 20;
|
const unsigned int maxCounter = 20;
|
||||||
if (++d->fpsCounter == maxCounter)
|
if (++d->fpsCounter == maxCounter)
|
||||||
|
|
@ -1663,6 +1743,7 @@ qglviewer::Vec Viewer::offset()const { return d->offset; }
|
||||||
void Viewer::setSceneBoundingBox(const qglviewer::Vec &min, const qglviewer::Vec &max)
|
void Viewer::setSceneBoundingBox(const qglviewer::Vec &min, const qglviewer::Vec &max)
|
||||||
{
|
{
|
||||||
QGLViewer::setSceneBoundingBox(min+d->offset, max+d->offset);
|
QGLViewer::setSceneBoundingBox(min+d->offset, max+d->offset);
|
||||||
|
d->drawGrid(camera()->sceneRadius());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::updateIds(CGAL::Three::Scene_item * item)
|
void Viewer::updateIds(CGAL::Three::Scene_item * item)
|
||||||
|
|
@ -1700,6 +1781,78 @@ void Viewer::enableClippingBox(QVector4D box[6])
|
||||||
|
|
||||||
|
|
||||||
bool Viewer::isOpenGL_4_3() const { return d->is_ogl_4_3; }
|
bool Viewer::isOpenGL_4_3() const { return d->is_ogl_4_3; }
|
||||||
|
void Viewer_impl::drawGrid(qreal size, int nbSubdivisions)
|
||||||
|
{
|
||||||
|
std::vector<float> v_Grid;
|
||||||
|
std::vector<float> v_gAxis;
|
||||||
|
std::vector<float> n_gAxis;
|
||||||
|
std::vector<float> c_gAxis;
|
||||||
|
for (int i=0; i<=nbSubdivisions; ++i)
|
||||||
|
{
|
||||||
|
const float pos = size*(2.0*i/nbSubdivisions-1.0);
|
||||||
|
v_Grid.push_back(pos);
|
||||||
|
v_Grid.push_back(-size);
|
||||||
|
v_Grid.push_back(0.0);
|
||||||
|
|
||||||
|
v_Grid.push_back(pos);
|
||||||
|
v_Grid.push_back(+size);
|
||||||
|
v_Grid.push_back(0.0);
|
||||||
|
|
||||||
|
v_Grid.push_back(-size);
|
||||||
|
v_Grid.push_back(pos);
|
||||||
|
v_Grid.push_back(0.0);
|
||||||
|
|
||||||
|
v_Grid.push_back( size);
|
||||||
|
v_Grid.push_back( pos);
|
||||||
|
v_Grid.push_back( 0.0);
|
||||||
|
}
|
||||||
|
rendering_program_dist.bind();
|
||||||
|
vao[2].bind();
|
||||||
|
buffers[4].bind();
|
||||||
|
buffers[4].allocate(v_Grid.data(),static_cast<int>(v_Grid.size()*sizeof(float)));
|
||||||
|
rendering_program_dist.enableAttributeArray("vertex");
|
||||||
|
rendering_program_dist.setAttributeBuffer("vertex",GL_FLOAT,0,3);
|
||||||
|
buffers[4].release();
|
||||||
|
vao[2].release();
|
||||||
|
rendering_program_dist.release();
|
||||||
|
grid_size = v_Grid.size();
|
||||||
|
|
||||||
|
Viewer_impl::AxisData data;
|
||||||
|
v_gAxis.resize(0);
|
||||||
|
n_gAxis.resize(0);
|
||||||
|
c_gAxis.resize(0);
|
||||||
|
data.vertices = &v_gAxis;
|
||||||
|
data.normals = &n_gAxis;
|
||||||
|
data.colors = &c_gAxis;
|
||||||
|
makeArrow(0.02*size,10, qglviewer::Vec(0,0,0),qglviewer::Vec(size,0,0),qglviewer::Vec(1,0,0), data);
|
||||||
|
makeArrow(0.02*size,10, qglviewer::Vec(0,0,0),qglviewer::Vec(0,size,0),qglviewer::Vec(0,1,0), data);
|
||||||
|
makeArrow(0.02*size,10, qglviewer::Vec(0,0,0),qglviewer::Vec(0,0,size),qglviewer::Vec(0,0,1), data);
|
||||||
|
|
||||||
|
rendering_program.bind();
|
||||||
|
vao[3].bind();
|
||||||
|
buffers[5].bind();
|
||||||
|
buffers[5].allocate(v_gAxis.data(), static_cast<int>(v_gAxis.size()) * sizeof(float));
|
||||||
|
rendering_program.enableAttributeArray("vertex");
|
||||||
|
rendering_program.setAttributeBuffer("vertex",GL_FLOAT,0,3);
|
||||||
|
buffers[5].release();
|
||||||
|
|
||||||
|
buffers[6].bind();
|
||||||
|
buffers[6].allocate(n_gAxis.data(), static_cast<int>(n_gAxis.size() * sizeof(float)));
|
||||||
|
rendering_program.enableAttributeArray("normal");
|
||||||
|
rendering_program.setAttributeBuffer("normal",GL_FLOAT,0,3);
|
||||||
|
buffers[6].release();
|
||||||
|
|
||||||
|
buffers[7].bind();
|
||||||
|
buffers[7].allocate(c_gAxis.data(), static_cast<int>(c_gAxis.size() * sizeof(float)));
|
||||||
|
rendering_program.enableAttributeArray("colors");
|
||||||
|
rendering_program.setAttributeBuffer("colors",GL_FLOAT,0,3);
|
||||||
|
buffers[7].release();
|
||||||
|
vao[3].release();
|
||||||
|
|
||||||
|
rendering_program.release();
|
||||||
|
|
||||||
|
v_gaxis_size = v_gAxis.size();
|
||||||
|
|
||||||
|
}
|
||||||
QOpenGLFunctions_4_3_Compatibility* Viewer::openGL_4_3_functions() { return d->_recentFunctions; }
|
QOpenGLFunctions_4_3_Compatibility* Viewer::openGL_4_3_functions() { return d->_recentFunctions; }
|
||||||
#include "Viewer.moc"
|
#include "Viewer.moc"
|
||||||
|
|
|
||||||
|
|
@ -85,8 +85,7 @@ void deleteIds(CGAL::Three::Viewer_interface* viewer,
|
||||||
TextListItem* vitems,
|
TextListItem* vitems,
|
||||||
TextListItem* eitems,
|
TextListItem* eitems,
|
||||||
TextListItem* fitems,
|
TextListItem* fitems,
|
||||||
std::vector<TextItem*>* targeted_ids,
|
std::vector<TextItem*>* targeted_ids)
|
||||||
bool *all_primitives_displayed)
|
|
||||||
{
|
{
|
||||||
TextRenderer *renderer = viewer->textRenderer();
|
TextRenderer *renderer = viewer->textRenderer();
|
||||||
BOOST_FOREACH(TextItem* it, vitems->textList())
|
BOOST_FOREACH(TextItem* it, vitems->textList())
|
||||||
|
|
@ -102,7 +101,6 @@ void deleteIds(CGAL::Three::Viewer_interface* viewer,
|
||||||
fitems->clear();
|
fitems->clear();
|
||||||
renderer->removeTextList(fitems);
|
renderer->removeTextList(fitems);
|
||||||
targeted_ids->clear();
|
targeted_ids->clear();
|
||||||
*all_primitives_displayed = false;
|
|
||||||
viewer->update();
|
viewer->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -175,8 +173,7 @@ void compute_displayed_ids(Mesh& mesh,
|
||||||
TextListItem* vitems,
|
TextListItem* vitems,
|
||||||
TextListItem* eitems,
|
TextListItem* eitems,
|
||||||
TextListItem* fitems,
|
TextListItem* fitems,
|
||||||
std::vector<TextItem*>* targeted_ids,
|
std::vector<TextItem*>* targeted_ids)
|
||||||
bool *all_primitives_displayed)
|
|
||||||
{
|
{
|
||||||
typedef typename boost::graph_traits<Mesh>::face_descriptor face_descriptor;
|
typedef typename boost::graph_traits<Mesh>::face_descriptor face_descriptor;
|
||||||
typedef typename boost::graph_traits<Mesh>::vertex_descriptor vertex_descriptor;
|
typedef typename boost::graph_traits<Mesh>::vertex_descriptor vertex_descriptor;
|
||||||
|
|
@ -228,11 +225,11 @@ void compute_displayed_ids(Mesh& mesh,
|
||||||
if(text_item->position() == point)
|
if(text_item->position() == point)
|
||||||
{
|
{
|
||||||
//hide and stop
|
//hide and stop
|
||||||
deleteIds(viewer, vitems, eitems, fitems, targeted_ids, all_primitives_displayed);
|
deleteIds(viewer, vitems, eitems, fitems, targeted_ids);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deleteIds(viewer, vitems, eitems, fitems, targeted_ids, all_primitives_displayed);
|
deleteIds(viewer, vitems, eitems, fitems, targeted_ids);
|
||||||
// test the midpoint of edges of the closest face
|
// test the midpoint of edges of the closest face
|
||||||
BOOST_FOREACH(halfedge_descriptor e, halfedges_around_face(halfedge(selected_fh, mesh), mesh))
|
BOOST_FOREACH(halfedge_descriptor e, halfedges_around_face(halfedge(selected_fh, mesh), mesh))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 485 B |
|
|
@ -175,6 +175,15 @@ public :
|
||||||
//! Only returns children that have this item as a parent.
|
//! Only returns children that have this item as a parent.
|
||||||
//! Children of these children are not returned.
|
//! Children of these children are not returned.
|
||||||
QList<Scene_item*> getChildren() const {return children;}
|
QList<Scene_item*> getChildren() const {return children;}
|
||||||
|
|
||||||
|
//! \brief getChildrenForSelection returns the list of
|
||||||
|
//! children to select along with the group.
|
||||||
|
//!
|
||||||
|
//! When a `Scene_group_item` is added to the selection of the scene,
|
||||||
|
//! this function defines which of its children will be added too.
|
||||||
|
//! Typically overriden to allow applying an operation from the
|
||||||
|
//! Operation menu only to the parent item and not to its children.
|
||||||
|
virtual QList<Scene_item*> getChildrenForSelection() const {return children;}
|
||||||
//!Removes a Scene_item from the list of children.
|
//!Removes a Scene_item from the list of children.
|
||||||
//!@see getChildren() @see addChild()
|
//!@see getChildren() @see addChild()
|
||||||
void removeChild( Scene_item* item)
|
void removeChild( Scene_item* item)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue