Moved Scene_group_item.h to Three and updated the doc.

This commit is contained in:
Maxime Gimeno
2015-11-25 15:45:03 +01:00
parent dc7584cc9c
commit 9b4e2fbc0b
8 changed files with 66 additions and 44 deletions
+15
View File
@@ -121,6 +121,13 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
DOC "Path to CGAL/Three/Scene_item.h")
hide_variable(CGAL_THREE_SCENE_ITEM_H_PATH)
find_path(CGAL_THREE_SCENE_GROUP_ITEM_H_PATH
NAME CGAL/Three/Scene_group_item.h
PATHS ${CGAL_INCLUDE_DIRS}
NO_DEFAULT_PATH
DOC "Path to CGAL/Three/Scene_group_item.h")
hide_variable(CGAL_THREE_SCENE_GROUP_ITEM_H_PATH)
if(CGAL_THREE_SCENE_ITEM_H_PATH)
qt5_generate_moc( "${CGAL_THREE_SCENE_ITEM_H_PATH}/CGAL/Three/Scene_item.h"
"${CMAKE_CURRENT_BINARY_DIR}/Scene_item_moc.cpp" )
@@ -128,6 +135,13 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
message(FATAL_ERROR "Cannot find <CGAL/Three/Viewer_interface.h>")
endif()
if(CGAL_THREE_SCENE_GROUP_ITEM_H_PATH)
qt5_generate_moc( "${CGAL_THREE_SCENE_GROUP_ITEM_H_PATH}/CGAL/Three/Scene_group_item.h"
"${CMAKE_CURRENT_BINARY_DIR}/Scene_group_item_moc.cpp" )
else()
message(FATAL_ERROR "Cannot find <CGAL/Three/Scene_group_item.h>")
endif()
# AUXILIARY LIBRARIES
@@ -143,6 +157,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
Scene_item_moc.cpp
Scene_item.cpp #Scene_item.moc
Scene_group_item.cpp
Scene_group_item_moc.cpp
Polyhedron_demo_plugin_helper.cpp)
qt5_use_modules(demo_framework OpenGL Gui Widgets Script Xml)
+2 -2
View File
@@ -1693,8 +1693,8 @@ void MainWindow::recurseExpand(QModelIndex index)
}
QString name = scene->item(scene->getIdFromModelIndex(index))->name();
Scene_group_item* group =
qobject_cast<Scene_group_item*>(scene->item(scene->getIdFromModelIndex(index)));
CGAL::Three::Scene_group_item* group =
qobject_cast<CGAL::Three::Scene_group_item*>(scene->item(scene->getIdFromModelIndex(index)));
if(group && group->isExpanded())
{
+26 -26
View File
@@ -49,8 +49,8 @@ Scene::Scene(QObject* parent)
Scene::Item_id
Scene::addItem(CGAL::Three::Scene_item* item)
{
Scene_group_item* group =
qobject_cast<Scene_group_item*>(item);
CGAL::Three::Scene_group_item* group =
qobject_cast<CGAL::Three::Scene_group_item*>(item);
if(group)
m_group_entries.prepend(group);
Bbox bbox_before = bbox();
@@ -114,7 +114,7 @@ Scene::erase(int index)
return -1;
CGAL::Three::Scene_item* item = m_entries[index];
Q_FOREACH(Scene_group_item* group, m_group_entries)
Q_FOREACH(CGAL::Three::Scene_group_item* group, m_group_entries)
{
if(group->getChildren().contains(item))
group->removeChild(item);
@@ -158,13 +158,13 @@ Scene::erase(QList<int> indices)
}
Q_FOREACH(Scene_item* item, to_be_removed) {
Scene_group_item* group =
qobject_cast<Scene_group_item*>(item);
CGAL::Three::Scene_group_item* group =
qobject_cast<CGAL::Three::Scene_group_item*>(item);
if(group)
{
m_group_entries.removeAll(group);
}
Q_FOREACH(Scene_group_item* group_item, m_group_entries)
Q_FOREACH(CGAL::Three::Scene_group_item* group_item, m_group_entries)
if(group_item->getChildren().contains(item))
group_item->removeChild(item);
Q_EMIT itemAboutToBeDestroyed(item);
@@ -195,7 +195,7 @@ Scene::erase(QList<int> indices)
void Scene::remove_item_from_groups(Scene_item* item)
{
Q_FOREACH(Scene_group_item* group, m_group_entries)
Q_FOREACH(CGAL::Three::Scene_group_item* group, m_group_entries)
{
if(group->getChildren().contains(item))
{
@@ -660,8 +660,8 @@ bool Scene::dropMimeData(const QMimeData * /*data*/,
//get IDs of all children of selected groups
Q_FOREACH(int i, selected_items_list)
{
Scene_group_item* group =
qobject_cast<Scene_group_item*>(item(i));
CGAL::Three::Scene_group_item* group =
qobject_cast<CGAL::Three::Scene_group_item*>(item(i));
if(group)
Q_FOREACH(Scene_item* child, group->getChildren())
groups_children << item_id(child);
@@ -673,8 +673,8 @@ bool Scene::dropMimeData(const QMimeData * /*data*/,
items << item(i);
}
//Gets the group at the drop position
Scene_group_item* group =
qobject_cast<Scene_group_item*>(this->item(index_map[parent]));
CGAL::Three::Scene_group_item* group =
qobject_cast<CGAL::Three::Scene_group_item*>(this->item(index_map[parent]));
bool one_contained = false;
if(group)
{
@@ -694,7 +694,7 @@ bool Scene::dropMimeData(const QMimeData * /*data*/,
Q_FOREACH(Scene_item* item, items)
while(item->has_group!=0)
{
Q_FOREACH(Scene_group_item* group_item, m_group_entries)
Q_FOREACH(CGAL::Three::Scene_group_item* group_item, m_group_entries)
if(group_item->getChildren().contains(item))
{
group_item->removeChild(item);
@@ -956,7 +956,7 @@ Scene::Bbox Scene::bbox() const
}
return bbox;
}
QList<Scene_group_item*> Scene::group_entries() const
QList<CGAL::Three::Scene_group_item*> Scene::group_entries() const
{
return m_group_entries;
}
@@ -978,11 +978,11 @@ void Scene::group_added()
}
Q_EMIT restoreCollapsedState();
}
void Scene::changeGroup(Scene_item *item, Scene_group_item *target_group)
void Scene::changeGroup(Scene_item *item, CGAL::Three::Scene_group_item *target_group)
{
//remove item from the containing group if any
if(item->has_group!=0)
Q_FOREACH(Scene_group_item* group, m_group_entries)
Q_FOREACH(CGAL::Three::Scene_group_item* group, m_group_entries)
{
if(group->getChildren().contains(item))
{
@@ -1018,8 +1018,8 @@ void Scene::organize_items(Scene_item* item, QStandardItem* root, int loop)
for(int i=0; i<5; i++){
index_map[list.at(i)->index()] = m_entries.indexOf(item);
}
Scene_group_item* group =
qobject_cast<Scene_group_item*>(item);
CGAL::Three::Scene_group_item* group =
qobject_cast<CGAL::Three::Scene_group_item*>(item);
if(group)
{
Q_FOREACH(Scene_item*child, group->getChildren())
@@ -1032,8 +1032,8 @@ void Scene::organize_items(Scene_item* item, QStandardItem* root, int loop)
void Scene::setExpanded(QModelIndex id)
{
Scene_group_item* group =
qobject_cast<Scene_group_item*>(item(index_map.value(index(0, 0, id.parent()))));
CGAL::Three::Scene_group_item* group =
qobject_cast<CGAL::Three::Scene_group_item*>(item(index_map.value(index(0, 0, id.parent()))));
if(group)
{
group->setExpanded(true);
@@ -1041,8 +1041,8 @@ void Scene::setExpanded(QModelIndex id)
}
void Scene::setCollapsed(QModelIndex id)
{
Scene_group_item* group =
qobject_cast<Scene_group_item*>(item(index_map.value(index(0, 0, id.parent()))));
CGAL::Three::Scene_group_item* group =
qobject_cast<CGAL::Three::Scene_group_item*>(item(index_map.value(index(0, 0, id.parent()))));
if(group)
group->setExpanded(false);
}
@@ -1063,8 +1063,8 @@ void Scene::add_group()
QList<int> indices;
QList<int> blacklist;
Q_FOREACH(int id, selectionIndices()){
Scene_group_item* group =
qobject_cast<Scene_group_item*>(item(id));
CGAL::Three::Scene_group_item* group =
qobject_cast<CGAL::Three::Scene_group_item*>(item(id));
if(group)
Q_FOREACH(CGAL::Three::Scene_item *item, group->getChildren())
blacklist<<item_id(item);
@@ -1077,15 +1077,15 @@ void Scene::add_group()
if(indices.isEmpty())
all_in_one = false;
// new group to create
Scene_group_item * group = new Scene_group_item("new group");
CGAL::Three::Scene_group_item * group = new CGAL::Three::Scene_group_item("new group");
//group containing the selected item
Scene_group_item * existing_group = 0;
CGAL::Three::Scene_group_item * existing_group = 0;
//for each selected item
Q_FOREACH(int id, indices){
//if the selected item is in a group
if(item(id)->has_group!=0){
//for each group
Q_FOREACH(Scene_group_item *group, group_entries())
Q_FOREACH(CGAL::Three::Scene_group_item *group, group_entries())
{
//if the group contains the selected item
if(group->getChildren().contains(item(id))){
+6 -6
View File
@@ -21,7 +21,7 @@
#include <iostream>
#include <cmath>
#include <boost/variant.hpp>
#include "Scene_group_item.h"
#include <CGAL/Three/Scene_group_item.h>
class QEvent;
class QMouseEvent;
namespace GlSplat { class SplatRenderer; }
@@ -55,7 +55,7 @@ public:
int addItem(CGAL::Three::Scene_item* item);
//!Moves item to the targeted group.
void changeGroup(CGAL::Three::Scene_item* item, Scene_group_item* target_group);
void changeGroup(CGAL::Three::Scene_item* item, CGAL::Three::Scene_group_item* target_group);
//!Sets item as the item at index and calls @ref Scene_item#changed().
//!If emit_item_about_to_be_destroyed is set to true, emits
//!an itemAboutToBeDestroyed signal.
@@ -150,7 +150,7 @@ public:
/*! Sets the column data for the target index. Returns false if index is not valid and
* if role is not EditRole.*/
bool setData(const QModelIndex &index, const QVariant &value, int role);
QList<Scene_group_item*> group_entries() const ;
QList<CGAL::Three::Scene_group_item*> group_entries() const ;
QList<CGAL::Three::Scene_item*> item_entries() const ;
// auxiliary public function for QMainWindow
//!Selects the row at index i in the sceneView.
@@ -212,8 +212,8 @@ public Q_SLOTS:
{
Q_FOREACH(int i,l)
{
Scene_group_item* group =
qobject_cast<Scene_group_item*>(item(i));
CGAL::Three::Scene_group_item* group =
qobject_cast<CGAL::Three::Scene_group_item*>(item(i));
if(group)
{
QList<int> list;
@@ -267,7 +267,7 @@ private:
//! Index of the currently selected item.
int selected_item;
//!List containing all the scene_group_items.
QList<Scene_group_item*> m_group_entries;
QList<CGAL::Three::Scene_group_item*> m_group_entries;
//!List of indices of the currently selected items.
QList<int> selected_items_list;
//!Index of the item_A.
@@ -1,8 +1,8 @@
#include "Scene_group_item.h"
#include <CGAL/Three/Scene_group_item.h>
#include <QDebug>
using namespace CGAL::Three;
Scene_group_item::Scene_group_item(QString name)
: Scene_item(0,0)
{
+1
View File
@@ -127,6 +127,7 @@ dock widget visible or not.
- CGAL::Three::Viewer_interface
- CGAL::Three::Scene_interface
- CGAL::Three::Scene_item
- CGAL::Three::Scene_group_item
- CGAL::Three::Polyhedron_demo_plugin_helper
- CGAL::Three::Polyhedron_demo_plugin_interface
@@ -2,7 +2,6 @@
#define SCENE_GROUP_ITEM_H
#include <CGAL/Three/Scene_item.h>
#include "Messages_interface.h"
using namespace CGAL::Three;
#include <QtCore/qglobal.h>
@@ -11,7 +10,11 @@ using namespace CGAL::Three;
#else
# define DEMO_FRAMEWORK_EXPORT Q_DECL_IMPORT
#endif
namespace CGAL {
namespace Three {
//!A Scene_group_item is a virtual Scene_item that does not draw anything,
//! but regroups other items as its children. It allows the
//! user to apply several actions to multiple items at the same time.
class DEMO_FRAMEWORK_EXPORT Scene_group_item : public Scene_item
{
Q_OBJECT
@@ -22,12 +25,14 @@ public :
bool isFinite() const;
//!Returns true to avoid disturbing the BBox of the scene.
bool isEmpty() const ;
//!Getter for expanded.
//!@see expanded. @see setExpanded.
//!Returns if the group_item is currently expanded or collapsed in the view.
//! True means expanded, false means collapsed.
//! @see setExpanded.
bool isExpanded() const;
//! Setter for expanded.
//!Makes the group_item expanded or collapsed in the view.
//! True means expanded, false means collapsed.
void setExpanded(bool);
//!@see expanded. @see isExpanded.
//! @see isExpanded.
//!Returns an empty BBox to avoid disturbing the BBox of the scene.
Bbox bbox() const;
//!Not supported.
@@ -101,10 +106,11 @@ private:
QList<Scene_item*> children;
//!Updates the property has_group for each group and sub-groups containing new_item.
void add_group_number(Scene_item*new_item);
//!Specifies if the group_item is currently expanded or collapsed in the view.
bool expanded;
}; //end of class Scene_group_item
}
}
#endif // SCENE_GROUP_ITEM_H
+1 -1
View File
@@ -74,7 +74,7 @@ public:
virtual void attrib_buffers(int program_name) const = 0;
/*! Returns a program according to name.
* If the program does not exist yet, it is created and stored in #shader_programs.
* If the program does not exist yet, it is created and stored in shader_programs.
* name cans be :
* - PROGRAM_WITH_LIGHT : used for the facets
* - PROGRAM_WITHOUT_LIGHT : used for the points and lines