mirror of https://github.com/CGAL/cgal
Enhancements :
- Explicitate the doc - Make the Scnee_print_item_interface a real interface
This commit is contained in:
parent
965e6f545d
commit
05126f0971
|
|
@ -94,7 +94,7 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio
|
|||
return;
|
||||
poly_item->polyhedron()->normalize_border();
|
||||
if(poly_item->polyhedron()->size_of_border_halfedges()==0)
|
||||
message->warning("The polyhedorn has no border, therefore the Parameterization cannot apply.");
|
||||
message->warning("The polyhedron has no border, therefore the Parameterization cannot apply.");
|
||||
Polyhedron* pMesh = poly_item->polyhedron();
|
||||
if(!pMesh)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -4,10 +4,14 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "Scene.h"
|
||||
|
||||
#include <CGAL/Three/Scene_item.h>
|
||||
#include <CGAL/Three/Scene_print_interface_item.h>
|
||||
#include <CGAL/Three/Scene_zoomable_item_interface.h>
|
||||
|
||||
#include <CGAL/Three/Scene_item.h>
|
||||
#include <CGAL/Three/Scene_print_item_interface.h>
|
||||
|
||||
|
||||
#include <QObject>
|
||||
#include <QMetaObject>
|
||||
#include <QString>
|
||||
|
|
@ -855,7 +859,7 @@ void Scene::moveRowDown()
|
|||
}
|
||||
}
|
||||
Scene::Item_id Scene::mainSelectionIndex() const {
|
||||
return selected_item;
|
||||
return (selectionIndices().size() == 1) ? selected_item : -1;
|
||||
}
|
||||
|
||||
QList<int> Scene::selectionIndices() const {
|
||||
|
|
@ -897,10 +901,9 @@ void Scene::itemChanged(Item_id i)
|
|||
|
||||
Q_EMIT dataChanged(this->createIndex(i, 0),
|
||||
this->createIndex(i, LastColumn));
|
||||
// Q_EMIT restoreCollapsedState();
|
||||
}
|
||||
|
||||
void Scene::itemChanged(CGAL::Three::Scene_item* /* item */)
|
||||
void Scene::itemChanged(CGAL::Three::Scene_item*)
|
||||
{
|
||||
Q_EMIT dataChanged(this->createIndex(0, 0),
|
||||
this->createIndex(m_entries.size() - 1, LastColumn));
|
||||
|
|
@ -1133,18 +1136,13 @@ void Scene::changeGroup(Scene_item *item, CGAL::Three::Scene_group_item *target_
|
|||
Q_EMIT updated();
|
||||
}
|
||||
|
||||
float Scene::get_bbox_length() const
|
||||
{
|
||||
return bbox().ymax()-bbox().ymin();
|
||||
}
|
||||
|
||||
void Scene::printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface* viewer)
|
||||
{
|
||||
Scene_item *it = item(mainSelectionIndex());
|
||||
if(it)
|
||||
{
|
||||
//Only call printPrimitiveId if the item is a Scene_print_interface_item
|
||||
Scene_print_interface_item* item= dynamic_cast<Scene_print_interface_item*>(it);
|
||||
//Only call printPrimitiveId if the item is a Scene_print_item_interface
|
||||
Scene_print_item_interface* item= qobject_cast<Scene_print_item_interface*>(it);
|
||||
if(item)
|
||||
item->printPrimitiveId(point, viewer);
|
||||
}
|
||||
|
|
@ -1154,8 +1152,8 @@ void Scene::printPrimitiveIds(CGAL::Three::Viewer_interface* viewer)
|
|||
Scene_item *it = item(mainSelectionIndex());
|
||||
if(it)
|
||||
{
|
||||
//Only call printPrimitiveIds if the item is a Scene_print_interface_item
|
||||
Scene_print_interface_item* item= dynamic_cast<Scene_print_interface_item*>(it);
|
||||
//Only call printPrimitiveIds if the item is a Scene_print_item_interface
|
||||
Scene_print_item_interface* item= qobject_cast<Scene_print_item_interface*>(it);
|
||||
if(item)
|
||||
item->printPrimitiveIds(viewer);
|
||||
}
|
||||
|
|
@ -1164,8 +1162,8 @@ void Scene::updatePrimitiveIds(CGAL::Three::Viewer_interface* viewer, CGAL::Thre
|
|||
{
|
||||
if(it)
|
||||
{
|
||||
//Only call printPrimitiveIds if the item is a Scene_print_interface_item
|
||||
Scene_print_interface_item* item= dynamic_cast<Scene_print_interface_item*>(it);
|
||||
//Only call printPrimitiveIds if the item is a Scene_print_item_interface
|
||||
Scene_print_item_interface* item= qobject_cast<Scene_print_item_interface*>(it);
|
||||
if(item)
|
||||
{
|
||||
//As this function works as a toggle, the first call hides the ids and the second one shows them again,
|
||||
|
|
|
|||
|
|
@ -105,33 +105,23 @@ public:
|
|||
int selectionAindex() const Q_DECL_OVERRIDE;
|
||||
//!@returns the index of the Item_B
|
||||
int selectionBindex() const Q_DECL_OVERRIDE;
|
||||
|
||||
/*! Is called by Viewer::initializeGL(). Allows all the initialization
|
||||
* of OpenGL code that needs a context.
|
||||
*/
|
||||
void initializeGL() Q_DECL_OVERRIDE;
|
||||
/*! Sets the screen coordinates of the currently picked point.*/
|
||||
void setPickedPixel(const QPoint &p) Q_DECL_OVERRIDE {picked_pixel = p;}
|
||||
/*! Is called by Viewer::draw(Viewer_interface*). Calls draw_aux(false, viewer).
|
||||
* @see draw_aux(bool with_names, Viewer_interface).*/
|
||||
void draw(CGAL::Three::Viewer_interface*) Q_DECL_OVERRIDE;
|
||||
/*! Is called by Viewer::drawWithNames(Viewer_interface*). Calls draw_aux(true, viewer).
|
||||
* @see draw_aux(bool with_names, Viewer_interface).*/
|
||||
void drawWithNames(CGAL::Three::Viewer_interface*) Q_DECL_OVERRIDE;
|
||||
/*! Manages the key events.
|
||||
* @returns true if the keyEvent executed well.
|
||||
*/
|
||||
bool keyPressEvent(QKeyEvent* e) Q_DECL_OVERRIDE;
|
||||
|
||||
//! Print the text item closest to `point`.
|
||||
void printPrimitiveId(QPoint point,
|
||||
CGAL::Three::Viewer_interface*) Q_DECL_OVERRIDE;
|
||||
//!Prints all text items.
|
||||
void printPrimitiveIds(CGAL::Three::Viewer_interface*) Q_DECL_OVERRIDE;
|
||||
//!Re-computes the primitiveIds for `item`
|
||||
void updatePrimitiveIds(Viewer_interface *, Scene_item *item) Q_DECL_OVERRIDE;
|
||||
bool testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer) Q_DECL_OVERRIDE;
|
||||
//!@returns the scene bounding box
|
||||
Bbox bbox() const Q_DECL_OVERRIDE;
|
||||
float get_bbox_length() const Q_DECL_OVERRIDE;
|
||||
|
||||
//!@returns the length of the bounding box's diagonal.
|
||||
double len_diagonal() const Q_DECL_OVERRIDE
|
||||
{
|
||||
|
|
@ -174,23 +164,15 @@ public Q_SLOTS:
|
|||
void setExpanded(QModelIndex);
|
||||
//!Specifies a group as Collapsed for the view
|
||||
void setCollapsed(QModelIndex);
|
||||
/*!
|
||||
*Calls itemChanged() on the sender if it's an item.
|
||||
|
||||
*/
|
||||
//!Calls itemChanged() on the sender if it's an item.
|
||||
void itemChanged();
|
||||
/*! Notifies the scene that the item at index i was modified.
|
||||
* Called by the items. Calls @ref Scene_item#changed().
|
||||
* This function is called by the items.*/
|
||||
void itemChanged(int i) Q_DECL_OVERRIDE;
|
||||
/*! Notifies the scene that the item was modified.
|
||||
* Calls @ref Scene_item#changed().
|
||||
* This function is called by the items.*/
|
||||
void itemChanged(CGAL::Three::Scene_item*) Q_DECL_OVERRIDE;
|
||||
//!Removes item from all the groups of the scene.
|
||||
void remove_item_from_groups(CGAL::Three::Scene_item* item);
|
||||
|
||||
void addGroup(Scene_group_item* group) Q_DECL_OVERRIDE;
|
||||
void addGroup(Scene_group_item* group);
|
||||
//!Re-organizes the sceneView.
|
||||
void redraw_model();
|
||||
//! Sets the selected item to the target index. Emits a signal to notify
|
||||
|
|
|
|||
|
|
@ -221,13 +221,13 @@ QString CGAL::Three::Scene_item::computeStats(int )
|
|||
return QString();
|
||||
}
|
||||
|
||||
void CGAL::Three::Scene_item::printPrimitiveId(QPoint, CGAL::Three::Viewer_interface*)
|
||||
/*void CGAL::Three::Scene_item::printPrimitiveId(QPoint, CGAL::Three::Viewer_interface*)
|
||||
{
|
||||
}
|
||||
|
||||
void CGAL::Three::Scene_item::printPrimitiveIds(CGAL::Three::Viewer_interface*)const
|
||||
{
|
||||
}
|
||||
}*/
|
||||
bool CGAL::Three::Scene_item::testDisplayId(double, double, double, CGAL::Three::Viewer_interface*)
|
||||
{
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
#define SCENE_POLYHEDRON_ITEM_H
|
||||
|
||||
#include "Scene_polyhedron_item_config.h"
|
||||
#include <CGAL/Three/Scene_item.h>
|
||||
#include <CGAL/Three/Scene_print_item_interface.h>
|
||||
#include <CGAL/Three/Scene_item.h>
|
||||
#include <CGAL/Three/TextRenderer.h>
|
||||
#include "Polyhedron_type_fwd.h"
|
||||
#include "Polyhedron_type.h"
|
||||
|
|
@ -23,7 +24,10 @@ struct Scene_polyhedron_item_priv;
|
|||
// This class represents a polyhedron in the OpenGL scene
|
||||
class SCENE_POLYHEDRON_ITEM_EXPORT Scene_polyhedron_item
|
||||
: public CGAL::Three::Scene_item,
|
||||
public CGAL::Three::Scene_zoomable_item_interface{
|
||||
public CGAL::Three::Scene_zoomable_item_interface,
|
||||
public CGAL::Three::Scene_print_item_interface{
|
||||
Q_INTERFACES(CGAL::Three::Scene_print_item_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PrintInterface/1.0")
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(CGAL::Three::Scene_zoomable_item_interface)
|
||||
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.ZoomInterface/1.0")
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class Polyhedron_demo_io_plugin_interface
|
|||
{
|
||||
public:
|
||||
//!Returns the name of the plugin
|
||||
//!It is used by the loading system.
|
||||
virtual QString name() const = 0;
|
||||
virtual ~Polyhedron_demo_io_plugin_interface() {}
|
||||
/*! The filters for the names of the files that can be used
|
||||
|
|
@ -44,17 +45,27 @@ public:
|
|||
* Example : to filter OFF files : return "OFF files (*.off)"
|
||||
*/
|
||||
virtual QString nameFilters() const = 0;
|
||||
//!Returns only the filters used for saving. The default is `nameFilters()`.
|
||||
//! You must override this function to change its behavior.
|
||||
virtual QString saveNameFilters() const {return nameFilters();}
|
||||
//!Returns only the filters used for loading. The default is `nameFilters()`.
|
||||
//! You must override this function to change its behavior.
|
||||
//! If multiple plugins have the same load filters, only once will be kept,
|
||||
//! so be careful not to use one that already exists.
|
||||
virtual QString loadNameFilters() const {return nameFilters();}
|
||||
|
||||
//! Specifies if the io_plugin is able to load an item or not.
|
||||
//! This must be overriden.
|
||||
virtual bool canLoad() const = 0;
|
||||
//! Loads an item from a file.
|
||||
//! This must be overriden.
|
||||
virtual Scene_item* load(QFileInfo fileinfo) = 0;
|
||||
//!Specifies if the io_plugin can save the item or not.
|
||||
//!This must be overriden.
|
||||
virtual bool canSave(const Scene_item*) = 0;
|
||||
//!Saves the item in the file corresponding to the path
|
||||
//!contained in fileinfo. Returns false if error.
|
||||
//! This must be overriden.
|
||||
virtual bool save(const Scene_item*, QFileInfo fileinfo) = 0;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,11 +50,9 @@ class SCENE_ITEM_EXPORT Polyhedron_demo_plugin_helper
|
|||
public:
|
||||
|
||||
/*! \brief Gets an item of the templated type.
|
||||
*
|
||||
* The function first checks if the selected item is of the wanted type. If not, it will look in the scene entries if there is at least one item of the
|
||||
* right type, make it the selection and return it.
|
||||
* \return the first item found with the templated type
|
||||
* \return NULL if none is found
|
||||
* \returns The currently selected `SceneType` item
|
||||
* \returns the first `SceneType` item found in the scene's list of items if the selected item is not a `SceneType`
|
||||
* \returns NULL if there is no `SceneType` in the list.
|
||||
*/
|
||||
template<class SceneType>
|
||||
SceneType* getSelectedItem() const{
|
||||
|
|
@ -84,7 +82,8 @@ public:
|
|||
void addDockWidget(QDockWidget* dock);
|
||||
/*! \brief Automatically connects each action of the plugin to the corresponding slot.
|
||||
*
|
||||
* All actions in actions() must have their slot name on_ActionsName_triggered().
|
||||
* \attention Each action named `ActionName` in the plugin's `actions()` list must have a corresponding slot named `on_ActionsName_triggered()`
|
||||
* in the plugin.
|
||||
*/
|
||||
void autoConnectActions();
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -37,23 +37,28 @@ namespace CGAL {
|
|||
namespace Three {
|
||||
class Scene_interface;
|
||||
/*!
|
||||
* This class gives some virtual functions to help making a plugin
|
||||
* This virtual class provides the basic functions used for making a plugin.
|
||||
*/
|
||||
class Polyhedron_demo_plugin_interface
|
||||
{
|
||||
public:
|
||||
//! Initializes the plugin and gives access to a Message interface, that
|
||||
//! can be used to display messages in the console dock widget.
|
||||
//! @see init(QMainWindow*, CGAL::Three::Scene_interface*)
|
||||
//! \brief Initializes the plugin
|
||||
//! This function acts like a constructor. This is where the attributes must be initialized.
|
||||
//! The Message_interface allows to print warnings or errors on the screen and the `Console` widget.
|
||||
virtual void init(QMainWindow* , CGAL::Three::Scene_interface* , Messages_interface*) = 0;
|
||||
|
||||
//! Decides if the plugin's actions will be displayed or not.
|
||||
//! @returns \c true, if the plugin is applicable, \c false
|
||||
//! \brief Indicates if an action is usable or not.
|
||||
//! This function usually tests the type of the selected item to determine if `action` can be applied to it,
|
||||
//! but not necessarly.
|
||||
//! @returns \c true if `action` can be called in the current state, \c false
|
||||
//! otherwise
|
||||
virtual bool applicable(QAction*) const = 0;
|
||||
//!The list of the actions of the plugin.
|
||||
virtual bool applicable(QAction* action) const = 0;
|
||||
//!Contains all the plugin's actions.
|
||||
virtual QList<QAction*> actions() const = 0;
|
||||
//!If you need to do something when the plugin is closed, do it here
|
||||
//!\brief Is called when the application is closed.
|
||||
//! Override this function if you need to perform a specific action
|
||||
//! when the application is closed, like hide the widgets if you don't want
|
||||
//! their visibility to be saved.
|
||||
virtual void closure() {
|
||||
}
|
||||
protected :
|
||||
|
|
|
|||
|
|
@ -33,30 +33,44 @@ namespace Three {
|
|||
class Scene_item;
|
||||
|
||||
|
||||
// Base class to interact with the scene from the viewer.
|
||||
//! Base class to interact with the scene from the viewer.
|
||||
class Scene_draw_interface {
|
||||
public:
|
||||
virtual ~Scene_draw_interface(){}
|
||||
|
||||
/*! Is called by Viewer::initializeGL(). Allows all the initialization
|
||||
* of OpenGL code that needs a context.
|
||||
*/
|
||||
virtual void initializeGL() = 0;
|
||||
|
||||
//! \brief Draws the items.
|
||||
//! It is called by Viewer::draw().
|
||||
virtual void draw(CGAL::Three::Viewer_interface*) = 0;
|
||||
//!\brief draws the scene in a hidden frame to perform picking.
|
||||
//! Is called by Viewer::drawWithNames().
|
||||
virtual void drawWithNames(CGAL::Three::Viewer_interface*) = 0;
|
||||
/*! Sets the screen coordinates of the currently picked point.*/
|
||||
//!Pick the point `e` on the screen.
|
||||
virtual void setPickedPixel(const QPoint &e) = 0;
|
||||
//! \brief Manages the key events.
|
||||
//! Override this function to perform actions when keys are pressed.
|
||||
//! @returns true if the keyEvent executed well.
|
||||
//!
|
||||
virtual bool keyPressEvent(QKeyEvent* e) = 0;
|
||||
virtual float get_bbox_length() const = 0;
|
||||
//!\brief print theTextItems.
|
||||
virtual void printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface*) = 0;
|
||||
//!\brief update theTextItems.
|
||||
virtual void updatePrimitiveIds(CGAL::Three::Viewer_interface* , CGAL::Three::Scene_item*) = 0;
|
||||
|
||||
/*!
|
||||
* \brief testDisplayId checks if the id at position (x,y,z) is visible or not.
|
||||
* \param x the X coordinate of the id's position.
|
||||
* \param y the Y coordinate of the id's position.
|
||||
* \param z the Z coordinate of the id's position.
|
||||
* \brief checks if the text at position (x,y,z) is visible or not.
|
||||
* \param x the X coordinate of theTextItem's position.
|
||||
* \param y the Y coordinate of theTextItem's position.
|
||||
* \param z the Z coordinate of theTextItem's position.
|
||||
* \param viewer the viewer used to display the Scene.
|
||||
* \return true if the ID is visible. */
|
||||
* \return true if the TextItem is visible. */
|
||||
virtual bool testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer) = 0;
|
||||
/*!
|
||||
* \brief printPrimitiveIds displays all the Ids if there are less than max_textItems.
|
||||
* \brief printPrimitiveIds displays all the TextItems if there are less than Viewer::max_textItems.
|
||||
*/
|
||||
virtual void printPrimitiveIds(CGAL::Three::Viewer_interface*) = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,9 +37,11 @@ using namespace CGAL::Three;
|
|||
#endif
|
||||
namespace CGAL {
|
||||
namespace Three {
|
||||
//!A Scene_group_item is a virtual Scene_item that does not draw anything,
|
||||
//!A Scene_group_item is a special 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.
|
||||
//! A custom Scene_item can derive from it to have children. They appear
|
||||
//! hierarchically in the Geometric Objects list.
|
||||
class DEMO_FRAMEWORK_EXPORT Scene_group_item : public Scene_item
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -54,11 +56,14 @@ public :
|
|||
bool isEmpty() const ;
|
||||
/*!
|
||||
* \brief Locks a child
|
||||
*
|
||||
* A locked child cannot be moved out of the group nor can it be deleted.
|
||||
* Use it to prevent a child to be destroyed without its parent.
|
||||
*/
|
||||
void lockChild(CGAL::Three::Scene_item*);
|
||||
/*!
|
||||
* \brief Unlocks a child
|
||||
*
|
||||
* @see lockChild()
|
||||
*/
|
||||
void unlockChild(CGAL::Three::Scene_item*);
|
||||
|
|
@ -68,33 +73,59 @@ public :
|
|||
* @see lockChild()
|
||||
*/
|
||||
bool isChildLocked(CGAL::Three::Scene_item*);
|
||||
//!Returns if the group_item is currently expanded or collapsed in the view.
|
||||
//!Returns if the group_item is currently expanded or collapsed in the Geometric Objects list.
|
||||
//! True means expanded, false means collapsed.
|
||||
//! @see setExpanded.
|
||||
//! @see isExpanded().
|
||||
bool isExpanded() const;
|
||||
//!Makes the group_item expanded or collapsed in the view.
|
||||
//! True means expanded, false means collapsed.
|
||||
//! @see isExpanded().
|
||||
void setExpanded(bool);
|
||||
//! @see isExpanded.
|
||||
//!Returns an empty BBox to avoid disturbing the BBox of the scene.
|
||||
//!Returns an empty Bbox to avoid disturbing the Bbox of the scene.
|
||||
Bbox bbox() const;
|
||||
//!Not supported.
|
||||
Scene_item* clone() const {return 0;}
|
||||
//! Indicates if the rendering mode is supported.
|
||||
//! \returns true for all rendering modes that are shared by
|
||||
//! all of the children.
|
||||
bool supportsRenderingMode(RenderingMode m) const;
|
||||
//!Prints the number of children.
|
||||
//!\returns a string containing the number of children.
|
||||
QString toolTip() const;
|
||||
|
||||
/// Draw functions
|
||||
/// Scene_group_item's children are not drawn by the scene, they are drawn by the group.
|
||||
///@{
|
||||
//!\brief draws all the children
|
||||
//!
|
||||
//! Calls `Scene_item::draw()`, then calls `Scene_item::drawEdges()`
|
||||
//! and `Scene_item::drawPoints` for each child if its current
|
||||
//! rendering mode is adequat.
|
||||
//! @see #RenderingMode
|
||||
virtual void draw(CGAL::Three::Viewer_interface*) const;
|
||||
//!\brief draws all the children
|
||||
//!
|
||||
//! Calls `Scene_item::drawEdges()`, then calls `Scene_item::draw()`
|
||||
//! and `Scene_item::drawPoints` for each child if its current
|
||||
//! rendering mode is adequat.
|
||||
//! @see #RenderingMode
|
||||
virtual void drawEdges(CGAL::Three::Viewer_interface*) const;
|
||||
//!\brief draws all the children
|
||||
//!
|
||||
//! Calls `Scene_item::drawPoints()`, then calls `Scene_item::draw()`
|
||||
//! and `Scene_item::drawEdges()` for each child if its current
|
||||
//! rendering mode is adequat.
|
||||
//! @see #RenderingMode
|
||||
virtual void drawPoints(CGAL::Three::Viewer_interface*) const;
|
||||
//!\brief draws all the children
|
||||
//!
|
||||
//! Calls `Scene_item::drawSplats()` for each child if its current
|
||||
//! rendering mode is `Splatting`.
|
||||
//! @see #RenderingMode
|
||||
virtual void drawSplats(CGAL::Three::Viewer_interface*) const;
|
||||
///@}
|
||||
|
||||
//!Adds a Scene_item* to the list of children.
|
||||
//!@see getChildren. @see removeChild.
|
||||
//!Adds a CGAL::Three::Scene_item* to the list of children.
|
||||
//!@see getChildren() @see removeChild()
|
||||
void addChild(Scene_item* new_item);
|
||||
//!Sets all the children to the specified color.
|
||||
void setColor(QColor c);
|
||||
|
|
@ -138,10 +169,13 @@ public :
|
|||
void setSplattingMode(){
|
||||
setRenderingMode(Splatting);
|
||||
}
|
||||
//!Returns a list of all the direct children.
|
||||
//! \brief Returns a list of all the direct children.
|
||||
//!
|
||||
//! Only returns children that have this item as a parent.
|
||||
//! Children of these children are not returned.
|
||||
QList<Scene_item*> getChildren() const {return children;}
|
||||
//!Removes a Scene_item from the list of children.
|
||||
//!@see getChildren @see addChild
|
||||
//!@see getChildren() @see addChild()
|
||||
void removeChild( Scene_item* item)
|
||||
{
|
||||
if(isChildLocked(item))
|
||||
|
|
@ -155,12 +189,16 @@ public :
|
|||
void moveDown(int);
|
||||
|
||||
public Q_SLOTS:
|
||||
//!Let the scene know that the item has not been drawn yet.
|
||||
//!\brief Redraws children.
|
||||
//!
|
||||
//! As each drawing function of a group draws all parts of its children,
|
||||
//! once any of these functions is called, we skip all drawing calls
|
||||
//! until `resetDraw()` is called. This keeps children from being
|
||||
//! drawn several times. It is automatically called at the end of the scene's
|
||||
//! `draw()` function.
|
||||
void resetDraw() { already_drawn = false;}
|
||||
private:
|
||||
//!Updates the property has_group for each group and sub-groups containing new_item.
|
||||
void update_group_number(Scene_item*new_item, int n);
|
||||
|
||||
bool expanded;
|
||||
mutable bool already_drawn;
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -19,10 +19,31 @@
|
|||
// Author(s) : Laurent RINEAU
|
||||
|
||||
//! \file Scene_interface.h
|
||||
|
||||
|
||||
#ifndef SCENE_INTERFACE_H
|
||||
#define SCENE_INTERFACE_H
|
||||
|
||||
#include <CGAL/license/Three.h>
|
||||
/*!
|
||||
* \ingroup PkgThree
|
||||
* The RenderingMode determines which of an item's primitives must be drawn.
|
||||
* It can be Points, PointsPlusNormals, Wireframe, Flat, FlatPlusEdges, or Gouraud.
|
||||
* - Points, PointsPlusNormals, and Wireframe have no light model.
|
||||
* - Flat and FlatPlusEdges use a basic light model with one normal per facet.
|
||||
* - Gouraud uses the same light model but with one normal per vertex.
|
||||
*/
|
||||
enum RenderingMode
|
||||
{
|
||||
Points = 0, //! Renders only points without lighting.
|
||||
PointsPlusNormals, //!Renders points and normals.
|
||||
Splatting, //!Renders splats. Splats are oriented points that look like discs.
|
||||
Wireframe, //!Renders only edges.
|
||||
Flat, //!Renders only faces, with a lighting per face.
|
||||
FlatPlusEdges, //!Renders flat faces and edges.
|
||||
Gouraud, //!Renders only faces, with a lighting per vertex.
|
||||
ShadedPoints, //!Renders only points with lighting.
|
||||
NumberOfRenderingMode //!Number of values in this enum.
|
||||
};
|
||||
|
||||
|
||||
#include <QString>
|
||||
|
|
@ -31,31 +52,12 @@
|
|||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <CGAL/Bbox_3.h>
|
||||
namespace CGAL{namespace Three{
|
||||
namespace CGAL{
|
||||
namespace Three{
|
||||
class Scene_item;
|
||||
class Scene_group_item;
|
||||
}}
|
||||
// OpenGL rendering mode
|
||||
/*!
|
||||
* Contains the class Scene_interface and the enum RenderingMode.
|
||||
*/
|
||||
/*!
|
||||
* \brief The RenderingMode enum
|
||||
* Can be Points, PointsPlusNormals, Wireframe, Flat, FlatPlusEdges, or Gouraud.
|
||||
* - Points, PointsPlusNormals, and Wireframe have no light model.
|
||||
* - Flat and FlatPlusEdges use a basic light model with one normal per facet.
|
||||
* - Gouraud use the same light model but with one normal per vertex.
|
||||
*/
|
||||
enum RenderingMode { Points = 0,
|
||||
PointsPlusNormals,
|
||||
Splatting,
|
||||
Wireframe,
|
||||
Flat,
|
||||
FlatPlusEdges,
|
||||
Gouraud,
|
||||
ShadedPoints,
|
||||
NumberOfRenderingMode};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
namespace CGAL {
|
||||
namespace Three{
|
||||
|
|
@ -65,22 +67,24 @@ namespace Three{
|
|||
class Scene_interface {
|
||||
public:
|
||||
|
||||
//!Contains the coordinates for the two extremities of the diagonal of a bounding box.
|
||||
//! Those points are respectively the left bottom front vertex and the right upper back vertex.
|
||||
//!A bounding box is a box with each face corresponding to an extremum of its contents.
|
||||
|
||||
typedef CGAL::Bbox_3 Bbox;
|
||||
|
||||
//!Integer used as the index of a Scene_item.
|
||||
//!\brief Integer used as the index of a Scene_item.
|
||||
//! An item's index is its position in the Geometric Objects list.
|
||||
typedef int Item_id;
|
||||
//!Virtual destructor
|
||||
virtual ~Scene_interface() {};
|
||||
//!Adds an item to the list of items.
|
||||
//!Adds an item to the Geometric Objects list.
|
||||
//!@returns the index of the new item.
|
||||
virtual Item_id addItem(CGAL::Three::Scene_item* item) = 0;
|
||||
//!Replace an item by a new one in the scene. The first is deleted and gives its index to the latter.
|
||||
//!If emit_item_about_to_be_destroyed is true, emits
|
||||
//!an itemAboutToBeDestroyed signal.
|
||||
//! \brief Replaces an item by a new one in the scene.
|
||||
//! The item which id is `id` is replaced by `item`.
|
||||
//! The first one is deleted and gives its index to the second one.
|
||||
//! If emit_item_about_to_be_destroyed is true, emits
|
||||
//! an itemAboutToBeDestroyed signal.
|
||||
//!@returns a pointer to the old item.
|
||||
virtual Scene_item* replaceItem(Item_id, CGAL::Three::Scene_item*, bool emit_item_about_to_be_destroyed = false) = 0;
|
||||
virtual Scene_item* replaceItem(Item_id id, CGAL::Three::Scene_item* item, bool emit_item_about_to_be_destroyed = false) = 0;
|
||||
//!Moves item to the targeted group.
|
||||
virtual void changeGroup(CGAL::Three::Scene_item* item, CGAL::Three::Scene_group_item* target_group) = 0;
|
||||
|
||||
|
|
@ -90,56 +94,56 @@ public:
|
|||
* @returns -1 if the list is empty.*/
|
||||
virtual Item_id erase(Item_id) = 0;
|
||||
|
||||
/*! Duplicates a scene item.
|
||||
/*! Creates a copy of the item whith the id `id`.
|
||||
* @returns the index of the new item (-1 on error).
|
||||
*/
|
||||
virtual Item_id duplicate(Item_id) = 0;
|
||||
virtual Item_id duplicate(Item_id id) = 0;
|
||||
|
||||
// Accessors (getters)
|
||||
//!
|
||||
//! \brief The number of items
|
||||
//!@returns the number of items in the scene.
|
||||
virtual int numberOfEntries() const = 0;
|
||||
//!
|
||||
//!\brief The `id`th item.
|
||||
//! @returns the item with the specified index.
|
||||
virtual CGAL::Three::Scene_item* item(Item_id) const = 0;
|
||||
//!
|
||||
virtual CGAL::Three::Scene_item* item(Item_id id) const = 0;
|
||||
//!\brief The id of `item`
|
||||
//! @returns the id of the specified item.
|
||||
virtual Item_id item_id(CGAL::Three::Scene_item*) const = 0;
|
||||
//!
|
||||
//!@returns the currently selected item's index. If several items are selected, returns the last one's index.
|
||||
virtual Item_id item_id(CGAL::Three::Scene_item* item) const = 0;
|
||||
//!\brief The currently selected item's index.
|
||||
//!@returns the currently selected item's index.
|
||||
//!@returns -1 if none or several items are selected
|
||||
virtual Item_id mainSelectionIndex() const = 0;
|
||||
//!
|
||||
//!The id of the currently selected item.
|
||||
//!@returns the list of currently selected items indices.
|
||||
virtual QList<Item_id> selectionIndices() const = 0;
|
||||
//!
|
||||
//!Item_A is designated with the column A/B in the Geometric Objetcts widget.
|
||||
//!@returns the index of the Item_A
|
||||
virtual Item_id selectionAindex() const = 0;
|
||||
//!
|
||||
//!Item_B is designated with the column A/B in the Geometric Objetcts widget.
|
||||
//!@returns the index of the Item_B
|
||||
virtual Item_id selectionBindex() const = 0;
|
||||
//!
|
||||
//!@returns the scene bounding box
|
||||
|
||||
//!\brief The scene's Bbox
|
||||
//!@returns the scene's bounding box
|
||||
//! @see Scene_interface::Bbox
|
||||
virtual Bbox bbox() const = 0;
|
||||
//!
|
||||
//!The length of the diagonal of the scene's Bbox
|
||||
//!@returns the length of the bounding box's diagonal.
|
||||
virtual double len_diagonal() const = 0;
|
||||
|
||||
public:
|
||||
/*! Emits a dataChanged signal. */
|
||||
virtual void itemChanged(Item_id i) = 0;
|
||||
/*! Emits a dataChanged signal.*/
|
||||
virtual void itemChanged(CGAL::Three::Scene_item*) = 0;
|
||||
//! Updates the information about the item `i`th in the
|
||||
//! Geometric Objects list and redraws the scene.
|
||||
virtual void itemChanged(Item_id i) = 0;
|
||||
//! Updates the information about `item` in the
|
||||
//! Geometric Objects list and redraws the scene.
|
||||
virtual void itemChanged(CGAL::Three::Scene_item* itme) = 0;
|
||||
|
||||
/*! Selects the item with the specified index. */
|
||||
virtual void setSelectedItem(Item_id) = 0;
|
||||
/*! Adds group to the Scene. If items were selected at the
|
||||
* moment this function is called, they are added to the group.
|
||||
* If all the selected items were in the same group, the new group
|
||||
* is added as a sub-group of this group.*/
|
||||
virtual void addGroup(Scene_group_item* group) = 0;
|
||||
|
||||
//! Selects the item with the specified index.
|
||||
virtual void setSelectedItem(Item_id) = 0;
|
||||
}; // end interface Scene_interface
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // SCENE_INTERFACE_H
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@
|
|||
#include <QOpenGLVertexArrayObject>
|
||||
#include <vector>
|
||||
#include <CGAL/Bbox_3.h>
|
||||
#include <CGAL/Three/Scene_print_interface_item.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Three {
|
||||
|
|
@ -51,8 +50,10 @@ namespace Three {
|
|||
|
||||
class Scene_group_item;
|
||||
class Viewer_interface;
|
||||
//! This class represents an object in the OpenGL scene
|
||||
class SCENE_ITEM_EXPORT Scene_item : public QObject, public CGAL::Three::Scene_print_interface_item {
|
||||
//! This class represents an object in the OpenGL scene.
|
||||
//! It contains all the functions called by the Scene. It
|
||||
//! acts like a mix between an interface and a helper.
|
||||
class SCENE_ITEM_EXPORT Scene_item : public QObject{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor color READ color WRITE setColor)
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
|
|
@ -62,54 +63,64 @@ class SCENE_ITEM_EXPORT Scene_item : public QObject, public CGAL::Three::Scene_p
|
|||
public:
|
||||
/*!
|
||||
* \brief The OpenGL_program_IDs enum
|
||||
*
|
||||
* This enum holds the OpenGL programs IDs that are given to getShaderProgram() and attribBuffers().
|
||||
*@see getShaderProgram
|
||||
* @see getShaderProgram
|
||||
* @see attribBuffers
|
||||
*/
|
||||
enum OpenGL_program_IDs
|
||||
{
|
||||
PROGRAM_WITH_LIGHT = 0, /** Used to render a surface or edge affected by the light. It uses a per fragment lighting model, and renders brighter the selected item.*/
|
||||
PROGRAM_WITHOUT_LIGHT, /** Used to render a polygon edge or points. It renders in a uniform color and is not affected by light. It renders the selected item in black.*/
|
||||
PROGRAM_NO_SELECTION, /** Used to render a polyline or a surface that is not affected by light, like a cutting plane. It renders in a uniform color that does not change with selection.*/
|
||||
PROGRAM_WITH_TEXTURE, /** Used to render a textured polyhedron. Affected by light.*/
|
||||
PROGRAM_PLANE_TWO_FACES, /** Used to render a two-faced plane. The two faces have a different color. Not affected by light.*/
|
||||
PROGRAM_WITH_TEXTURED_EDGES, /** Used to render the edges of a textured polyhedorn. Not affected by light.*/
|
||||
PROGRAM_INSTANCED, /** Used to display instanced rendered spheres.Affected by light.*/
|
||||
PROGRAM_INSTANCED_WIRE, /** Used to display instanced rendered wired spheres. Not affected by light.*/
|
||||
PROGRAM_C3T3, /** Used to render a c3t3_item. It discards any fragment on a side of a plane, meaning that nothing is displayed on this side of the plane. Affected by light.*/
|
||||
PROGRAM_C3T3_EDGES, /** Used to render the edges of a c3t3_item. It discards any fragment on a side of a plane, meaning that nothing is displayed on this side of the plane. Not affected by light.*/
|
||||
PROGRAM_CUTPLANE_SPHERES, /** Used to render the spheres of an item with a cut plane.*/
|
||||
PROGRAM_SPHERES, /** Used to render one or several spheres.*/
|
||||
PROGRAM_C3T3_TETS, /** Used to render the tetrahedra of the intersection of a c3t3_item.*/
|
||||
PROGRAM_FLAT, /** Used to render flat shading without pre computing normals*/
|
||||
NB_OF_PROGRAMS /** Holds the number of different programs in this enum.*/
|
||||
PROGRAM_WITH_LIGHT = 0, //! Used to render a surface or an edge affected by the light. It uses a per fragment lighting model, and renders the selected item brighter.
|
||||
PROGRAM_WITHOUT_LIGHT, //! Used to render a polyhedron edge or points. It renders in a uniform color and is not affected by light. \attention It renders the selected item in black.
|
||||
PROGRAM_NO_SELECTION, //! Used to render a polyline or a surface that is not affected by light, like a cutting plane. It renders in a uniform color that does not change with selection.
|
||||
PROGRAM_WITH_TEXTURE, //! Used to render a textured polyhedron. Affected by light.
|
||||
PROGRAM_PLANE_TWO_FACES, //! Used to render a two-faced plane. The two faces have a different color. Not affected by light.
|
||||
PROGRAM_WITH_TEXTURED_EDGES, //! Used to render the edges of a textured polyhedron. Not affected by light.
|
||||
PROGRAM_INSTANCED, //! Used to display instanced rendered spheres.Affected by light.
|
||||
PROGRAM_INSTANCED_WIRE, //! Used to display instanced rendered wired spheres. Not affected by light.
|
||||
PROGRAM_C3T3, //! Used to render a c3t3_item. It discards any fragment on a side of a plane, meaning that nothing is displayed on this side of the plane. Affected by light.
|
||||
PROGRAM_C3T3_EDGES, //! Used to render the edges of a c3t3_item. It discards any fragment on a side of a plane, meaning that nothing is displayed on this side of the plane. Not affected by light.
|
||||
PROGRAM_CUTPLANE_SPHERES, //! Used to render the spheres of an item with a cut plane.
|
||||
PROGRAM_SPHERES, //! Used to render one or several spheres.
|
||||
PROGRAM_C3T3_TETS, //! Used to render the tetrahedra of the intersection of a c3t3_item.
|
||||
PROGRAM_FLAT, //! Used to render flat shading without pre computing normals
|
||||
NB_OF_PROGRAMS //! Holds the number of different programs in this enum.
|
||||
};
|
||||
typedef CGAL::Bbox_3 Bbox;
|
||||
typedef qglviewer::ManipulatedFrame ManipulatedFrame;
|
||||
//! The default color of a scene_item.
|
||||
//! \brief The default color of a scene_item.
|
||||
//!
|
||||
//! This color is the one that will be displayed if none is specified after its creation.
|
||||
static const QColor defaultColor; // defined in Scene_item.cpp
|
||||
|
||||
//!The Constructor.
|
||||
/*!
|
||||
* Initializes the number of VBOs and VAOs and creates them.
|
||||
*/
|
||||
//!\brief The Constructor.
|
||||
//!
|
||||
//! This is where the vectors of VBOs and VAOs are initialized.
|
||||
Scene_item(int buffers_size = 20, int vaos_size = 10);
|
||||
|
||||
//! Sets the number of isolated vertices.
|
||||
//! \brief Sets the number of isolated vertices.
|
||||
//!
|
||||
//! This number will be displayed in a warning box at loading.
|
||||
//! @see getNbIsolatedvertices
|
||||
void setNbIsolatedvertices(std::size_t nb) { nb_isolated_vertices = nb;}
|
||||
//! Getter for the number of isolated vertices.
|
||||
//! @see setNbIsolatedvertices
|
||||
std::size_t getNbIsolatedvertices() const {return nb_isolated_vertices;}
|
||||
//!The destructor. It is virtual as the item is virtual.
|
||||
virtual ~Scene_item();
|
||||
//! Creates a new item as a copy of the sender.
|
||||
//! \brief Duplicates the item.
|
||||
//!
|
||||
//! Creates a new item as a copy of this one.
|
||||
virtual Scene_item* clone() const = 0;
|
||||
|
||||
//! Indicates if rendering mode is supported
|
||||
//! \brief Indicates if `m` is supported
|
||||
//!
|
||||
//! If it is, it will be displayed in the context menu of the item.
|
||||
virtual bool supportsRenderingMode(RenderingMode m) const = 0;
|
||||
//! Deprecated. Does nothing.
|
||||
virtual void draw() const {}
|
||||
/*! \brief The drawing function.
|
||||
* Draws the facets of the item in the viewer using OpenGL functions. The data
|
||||
/*! \brief The drawing function for faces.
|
||||
*
|
||||
* Draws the faces of the item in the viewer. The data
|
||||
* for the drawing is gathered in computeElements(), and is sent
|
||||
* to buffers in initializeBuffers().
|
||||
* @see computeElements()
|
||||
|
|
@ -118,8 +129,9 @@ public:
|
|||
virtual void draw(CGAL::Three::Viewer_interface*) const { draw(); }
|
||||
//! Deprecated. Does nothing.
|
||||
virtual void drawEdges() const { draw(); }
|
||||
/*! \brief The drawing function.
|
||||
* Draws the edges and lines of the item in the viewer using OpenGL functions. The data
|
||||
/*! \brief The drawing function for the edges.
|
||||
*
|
||||
* Draws the edges and lines of the item in the viewer. The data
|
||||
* for the drawing is gathered in computeElements(), and is sent
|
||||
* to buffers in initializeBuffers().
|
||||
* @see computeElements()
|
||||
|
|
@ -128,8 +140,9 @@ public:
|
|||
virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const { draw(viewer); }
|
||||
//! Deprecated. Does nothing.
|
||||
virtual void drawPoints() const { draw(); }
|
||||
/*! \brief The drawing function.
|
||||
* Draws the points of the item in the viewer using OpenGL functions. The data
|
||||
/*! \brief The drawing function for the points.
|
||||
*
|
||||
* Draws the points of the item in the viewer. The data
|
||||
* for the drawing is gathered in computeElements(), and is sent
|
||||
* to buffers in initializeBuffers().
|
||||
* @see computeElements()
|
||||
|
|
@ -139,7 +152,7 @@ public:
|
|||
|
||||
//! Draws the splats of the item in the viewer using GLSplat functions.
|
||||
virtual void drawSplats() const {}
|
||||
//! Draws the splats of the item in the viewer using GLSplat functions.
|
||||
//! Draws the splats of the item in the viewer using the GLSplat library.
|
||||
virtual void drawSplats(CGAL::Three::Viewer_interface*) const {drawSplats();}
|
||||
|
||||
//! Called by the scene. If b is true, then this item is currently selected.
|
||||
|
|
@ -147,30 +160,40 @@ public:
|
|||
|
||||
// Functions for displaying meta-data of the item
|
||||
//!\brief Contains meta-data about the item.
|
||||
//! Data is :Number of vertices, Number of edges, Number of facets,
|
||||
//! Volume, Area, Bounding box limits and Number of isolated points.
|
||||
//! @returns a QString containing meta-data about the item.
|
||||
virtual QString toolTip() const = 0;
|
||||
//! \brief contains graphical meta-data about the item.
|
||||
//! \brief Contains graphical meta-data about the item.
|
||||
//! @returns a QPixmap containing graphical meta-data about the item.
|
||||
virtual QPixmap graphicalToolTip() const { return QPixmap(); }
|
||||
//! \brief contains the font used for the data of the item.
|
||||
//! \brief Contains the font used for the data of the item.
|
||||
//! @returns a QFont containing the font used for the data of the item.
|
||||
virtual QFont font() const { return QFont(); }
|
||||
|
||||
// Functions that help the Scene to compute its bbox
|
||||
//! If isFinite() returns false, the BBox is not computed.
|
||||
//! \brief Determines if the item is finite or not.
|
||||
//!
|
||||
//! For example, a plane is not finite.
|
||||
//! If false, the BBox is not computed.
|
||||
virtual bool isFinite() const { return true; }
|
||||
//! Specifies if the item is empty or null.
|
||||
//! If true, the BBox is not computed.
|
||||
virtual bool isEmpty() const { return true; }
|
||||
//! \brief the item's bounding box.
|
||||
//!@returns the item's bounding box.
|
||||
//! \brief The item's bounding box.
|
||||
//!
|
||||
//! If the Bbox has never been computed, computes it and
|
||||
//! saves the result for further calls.
|
||||
//! @returns the item's bounding box.
|
||||
virtual Bbox bbox() const {
|
||||
if(!is_bbox_computed)
|
||||
compute_bbox();
|
||||
is_bbox_computed = true;
|
||||
return _bbox;
|
||||
}
|
||||
//! \brief the item's bounding box's diagonal length.
|
||||
//!
|
||||
//! If the diagonal's length has never been computed, computes it and
|
||||
//! saves the result for further calls.
|
||||
//! @returns the item's bounding box's diagonal length.
|
||||
virtual double diagonalBbox() const {
|
||||
if(!is_diag_bbox_computed)
|
||||
compute_diag_bbox();
|
||||
|
|
@ -178,37 +201,59 @@ public:
|
|||
return _diag_bbox;
|
||||
}
|
||||
|
||||
//!Finds the spot the closest to point and prints the id of the corresponding Primitive (vertex, edg or Facet).
|
||||
virtual void printPrimitiveId(QPoint, CGAL::Three::Viewer_interface*);
|
||||
virtual void printPrimitiveIds(CGAL::Three::Viewer_interface*)const;
|
||||
|
||||
//! Finds the spot the closest to `point` and prints the id of the corresponding Primitive (vertex, edge or face).
|
||||
//virtual void printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface*);
|
||||
//! Prints all the primitive ids if their number is not too high. The limit is
|
||||
//! editable in the View menu of the application.
|
||||
//virtual void printPrimitiveIds(CGAL::Three::Viewer_interface*)const;
|
||||
//! \brief Tests if an id should be displayed or not.
|
||||
//!
|
||||
//! Taken the coordinates of a 3D point, performs a ray shooting to verify
|
||||
//! that the point is not hidden by a face.
|
||||
virtual bool testDisplayId(double, double, double, CGAL::Three::Viewer_interface*);
|
||||
// Function about manipulation
|
||||
//! returns true if the item can have a ManipulatedFrame.
|
||||
//! Returns true if the item has a ManipulatedFrame.
|
||||
//! @see manipulatedFrame()
|
||||
virtual bool manipulatable() const { return false; }
|
||||
//!\brief The manipulatedFrame of the item.
|
||||
//!
|
||||
//! A manipulated frame is an independant system that can be
|
||||
//! translated or rotated using the Ctrl key and the mouse.
|
||||
//!@returns the manipulatedFrame of the item.
|
||||
virtual ManipulatedFrame* manipulatedFrame() { return 0; }
|
||||
|
||||
// Getters for the four basic properties
|
||||
//!Getter for the item's color.
|
||||
//! @returns the current color of the item.
|
||||
virtual QColor color() const { return color_; }
|
||||
//!Getter for the item's name.
|
||||
//! @returns the current name of the item.
|
||||
virtual QString name() const { return name_; }
|
||||
//! If the item is not visible, it is not drawn and its Bbox
|
||||
//! is ignored in the computation of the scene's.
|
||||
//! @returns the current visibility of the item.
|
||||
virtual bool visible() const { return visible_; }
|
||||
//!Getter for the item's rendering mode.
|
||||
//! @returns the current rendering mode of the item.
|
||||
//!@see RenderingMode
|
||||
virtual RenderingMode renderingMode() const { return rendering_mode; }
|
||||
//!The renderingMode's name.
|
||||
//! @returns the current rendering mode of the item as a human readable string.
|
||||
virtual QString renderingModeName() const;
|
||||
|
||||
//! Context menu
|
||||
//! \brief Context menu
|
||||
//!
|
||||
//! Contains the list of the supported rendering modes,
|
||||
//! the Operations menu, actions to save or clone the item if it is supported
|
||||
//! and any contextual action for the item.
|
||||
virtual QMenu* contextMenu();
|
||||
|
||||
//!Handles key press events.
|
||||
virtual bool keyPressEvent(QKeyEvent*){return false;}
|
||||
|
||||
//!The parent group, or 0 if the item is not in a group.
|
||||
//!The group containing the item.
|
||||
//! \returns the parent group if the item is in a group
|
||||
//! \returns 0 if the item is not in a group.
|
||||
Scene_group_item* parentGroup() const;
|
||||
|
||||
//!Contains the header for the table in the statistics dialog
|
||||
|
|
@ -385,8 +430,8 @@ protected:
|
|||
* @see invalidateOpenGLBuffers()*/
|
||||
RenderingMode prev_shading;
|
||||
/*! \todo replace it by RenderingMode().
|
||||
* \brief
|
||||
* Contains the current RenderingMode.
|
||||
* \brief Contains the current RenderingMode.
|
||||
*
|
||||
* This is used to determine if invalidateOpenGLBuffers should be called or not
|
||||
* in certain cases.
|
||||
* @see invalidateOpenGLBuffers()*/
|
||||
|
|
@ -407,7 +452,7 @@ protected:
|
|||
vaos[i] = n_vao;
|
||||
}
|
||||
|
||||
/*! Fills the VBOs with data. Must be called after each call to #compute_elements().
|
||||
/*! Fills the VBOs with data. Must be called after each call to #computeElements().
|
||||
* @see compute_elements()
|
||||
*/
|
||||
void initializeBuffers(){}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,14 @@ namespace Three {
|
|||
class Scene_item;
|
||||
|
||||
//! Base class to allow an item to copy properties from another.
|
||||
//! Properties reprensent the current state of an item : its color,
|
||||
//! the position of its manipulated frame, ...
|
||||
class Scene_item_with_properties {
|
||||
public:
|
||||
virtual ~Scene_item_with_properties(){}
|
||||
//!Copies properties from another Scene_item
|
||||
//!\brief Copies properties from another Scene_item.
|
||||
//!
|
||||
//! Override this function to specify what must be copied.
|
||||
virtual void copyProperties(Scene_item*)=0; //pure virtual method
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
// Copyright (c) 2009,2010,2012,2015 GeometryFactory Sarl (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Maxime GIMENO
|
||||
|
||||
#ifndef SCENE_PRINT_INTERFACE_ITEM_H
|
||||
#define SCENE_PRINT_INTERFACE_ITEM_H
|
||||
|
||||
#include <CGAL/license/Three.h>
|
||||
|
||||
#include <QPoint>
|
||||
namespace CGAL
|
||||
{
|
||||
namespace Three {
|
||||
class Viewer_interface;
|
||||
|
||||
|
||||
//! Base class to allow an item to print its primitive IDs.
|
||||
class Scene_print_interface_item {
|
||||
public:
|
||||
virtual ~Scene_print_interface_item(){}
|
||||
//!Print the ID of the selected primitive.
|
||||
virtual void printPrimitiveId(QPoint, CGAL::Three::Viewer_interface*) = 0;
|
||||
//!Prints the ID of all the primitives.
|
||||
virtual void printPrimitiveIds(CGAL::Three::Viewer_interface*)const = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // SCENE_PRINT_INTERFACE_ITEM_H
|
||||
|
||||
Loading…
Reference in New Issue