diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index d56000e588d..bd69076cc5e 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -175,6 +175,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) add_item(scene_c2t3_item Scene_c2t3_item.cpp)# Scene_c2t3_item.moc) + add_item(scene_group_item Scene_group_item.cpp) add_item(scene_polyhedron_item Scene_polyhedron_item.cpp ${statisticsPolyhedronUI_FILES})# Scene_polyhedron_item.moc) add_item(scene_polyhedron_transform_item Plugins/PCA/Scene_polyhedron_transform_item.cpp )#Scene_polyhedron_transform_item.moc) @@ -257,6 +258,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polyhedron_3 ) + ########### # PLUGINS # ########### @@ -265,9 +267,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) FOREACH(SUB_DIR ${DEMO_PLUGINS}) add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/Plugins/${SUB_DIR}") ENDFOREACH() - add_item(scene_group_item Scene_group_item.cpp) - polyhedron_demo_plugin(group_plugin Polyhedron_demo_group_plugin ${groupUI_FILES}) - target_link_libraries(group_plugin scene_group_item) + # # Exporting # diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_group_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_group_plugin.cpp deleted file mode 100644 index b21178da2ed..00000000000 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_group_plugin.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "Polyhedron_demo_group_plugin.h" -#include "Polyhedron_demo_group_plugin.moc" -#include "Scene.h" -#include -/**************** - * Group Plugin * - ****************/ - -void Polyhedron_demo_group_plugin::init(QMainWindow* mainWindow, - CGAL::Three::Scene_interface* scene_interface,Messages_interface* m ) { - //get the references - trueScene = dynamic_cast(scene_interface); - this->scene = scene_interface; - this->mw = mainWindow; - messages = m; - //creates and link the actions - actionAddToGroup= new QAction("Add new group", mw); - - if(actionAddToGroup) { - connect(actionAddToGroup, SIGNAL(triggered()), - this, SLOT(add_group())); - } - - QMenu* menuFile = mw->findChild("menuFile"); - if ( NULL != menuFile ) - { - QList menuFileActions = menuFile->actions(); - - // Look for action just after "Load..." action - QAction* actionAfterLoad = NULL; - for ( QList::iterator it_action = menuFileActions.begin(), - end = menuFileActions.end() ; it_action != end ; ++ it_action ) //Q_FOREACH( QAction* action, menuFileActions) - { - if ( NULL != *it_action && (*it_action)->text().contains("Load") ) - { - ++it_action; - if ( it_action != end && NULL != *it_action ) - { - actionAfterLoad = *it_action; - } - } - } - - // Insert "Load implicit function" action - if ( NULL != actionAfterLoad ) - { - menuFile->insertAction(actionAfterLoad,actionAddToGroup); - } - } -} diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_group_plugin.h b/Polyhedron/demo/Polyhedron/Polyhedron_demo_group_plugin.h deleted file mode 100644 index 6feb8e22ca4..00000000000 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_group_plugin.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef POLYHEDRON_DEMO_GROUP_H -#define POLYHEDRON_DEMO_GROUP_H -#include -#include -#include -#include -#include "Scene_group_item.h" -#include "CGAL/Three/Scene_interface.h" -#include "Scene.h" - -class Scene_interface; -#include "CGAL/Three/Polyhedron_demo_plugin_helper.h" -class Polyhedron_demo_group_plugin : - public QObject, - public CGAL::Three::Polyhedron_demo_plugin_helper -{ - //Configures CMake to use MOC correctly - Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") -public : - // To silent a warning -Woverloaded-virtual - // See http://stackoverflow.com/questions/9995421/gcc-woverloaded-virtual-warnings - using Polyhedron_demo_plugin_helper::init; - void init(QMainWindow* mw, CGAL::Three::Scene_interface* sc, Messages_interface*); - - bool applicable(QAction*) const - { - return true; - } - - Scene* trueScene; -public Q_SLOTS: - void add_group() { - //Find the indices of the selected items - QList indices; - QList blacklist; - Q_FOREACH(int id, scene->selectionIndices()){ - Scene_group_item* group = - qobject_cast(trueScene->item(id)); - if(group) - Q_FOREACH(Scene_item *item, group->getChildren()) - blacklist<item_id(item); - - if(!indices.contains(id) && !blacklist.contains(id)) - indices<item(id)->has_group!=0){ - //for each group - Q_FOREACH(Scene_group_item *item, trueScene->group_entries()) - { - //if the group contains the selected item - if(item->getChildren().contains(trueScene->item(id))){ - //if it is the first one, we initialize existing_group - if(existing_group == 0) - existing_group = item; - //else we check if it is the same group as before. - //If not, all selected items are not in the same group - else if(existing_group != item) - all_in_one = false; - break; - } - }//end for each group - } - //else it is impossible that all the selected items are in the same group - else{ - all_in_one = false; - break; - } - }//end foreach selected item - - //If all the selected items are in the same group, we put them in a sub_group of this group - if(all_in_one) - { - Q_FOREACH(int id, indices) - trueScene->changeGroup(trueScene->item(id),group); - trueScene->changeGroup(group, existing_group); - scene->addItem(group); - trueScene->group_added(); - } - //else wer create a new group - else - { - Q_FOREACH(int id, indices) - trueScene->changeGroup(trueScene->item(id),group); - scene->addItem(group); - trueScene->group_added(); - } - - } - - -private: - QAction* actionAddToGroup; - void print_message(QString message) { messages->information(message); } - Messages_interface* messages; - -}; //end of class Polyhedron_demo_group_plugin -#endif diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_group_plugin.ui b/Polyhedron/demo/Polyhedron/Polyhedron_demo_group_plugin.ui deleted file mode 100644 index c46f985f009..00000000000 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_group_plugin.ui +++ /dev/null @@ -1,86 +0,0 @@ - - - GroupDialog - - - - 0 - 0 - 400 - 300 - - - - Dialog - - - - - 30 - 240 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 9 - 9 - 371 - 211 - - - - - - - - - - - - - - - - buttonBox - accepted() - GroupDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - GroupDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - -