mirror of https://github.com/CGAL/cgal
The scene performs a check on the item to insure it is able to display its primitive IDs.
This commit is contained in:
parent
845a9c7bac
commit
8a155b4f5d
|
|
@ -5,6 +5,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "Scene.h"
|
#include "Scene.h"
|
||||||
#include <CGAL/Three/Scene_item.h>
|
#include <CGAL/Three/Scene_item.h>
|
||||||
|
#include <CGAL/Three/Scene_item_print_interface.h>
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
|
|
@ -1141,13 +1142,23 @@ void Scene::printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface* viewer
|
||||||
{
|
{
|
||||||
Scene_item *it = item(mainSelectionIndex());
|
Scene_item *it = item(mainSelectionIndex());
|
||||||
if(it)
|
if(it)
|
||||||
it->printPrimitiveId(point, viewer);
|
{
|
||||||
|
//Only call printPrimitiveId if the item is a Scene_item_print_interface
|
||||||
|
Scene_item_print_interface* item= dynamic_cast<Scene_item_print_interface*>(it);
|
||||||
|
if(item)
|
||||||
|
item->printPrimitiveId(point, viewer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void Scene::printPrimitiveIds(CGAL::Three::Viewer_interface* viewer)
|
void Scene::printPrimitiveIds(CGAL::Three::Viewer_interface* viewer)
|
||||||
{
|
{
|
||||||
Scene_item *it = item(mainSelectionIndex());
|
Scene_item *it = item(mainSelectionIndex());
|
||||||
if(it)
|
if(it)
|
||||||
it->printPrimitiveIds(viewer);
|
{
|
||||||
|
//Only call printPrimitiveIds if the item is a Scene_item_print_interface
|
||||||
|
Scene_item_print_interface* item= dynamic_cast<Scene_item_print_interface*>(it);
|
||||||
|
if(item)
|
||||||
|
item->printPrimitiveIds(viewer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bool Scene::testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer)
|
bool Scene::testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ namespace Three {
|
||||||
class Scene_group_item;
|
class Scene_group_item;
|
||||||
class Viewer_interface;
|
class Viewer_interface;
|
||||||
//! This class represents an object in the OpenGL scene
|
//! This class represents an object in the OpenGL scene
|
||||||
class SCENE_ITEM_EXPORT Scene_item : public QObject, CGAL::Three::Scene_item_print_interface {
|
class SCENE_ITEM_EXPORT Scene_item : public QObject, public CGAL::Three::Scene_item_print_interface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QColor color READ color WRITE setColor)
|
Q_PROPERTY(QColor color READ color WRITE setColor)
|
||||||
Q_PROPERTY(QString name READ name WRITE setName)
|
Q_PROPERTY(QString name READ name WRITE setName)
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ namespace Three {
|
||||||
class Viewer_interface;
|
class Viewer_interface;
|
||||||
|
|
||||||
|
|
||||||
//! Base class to allow an item to print ts primitive.
|
//! Base class to allow an item to print its primitive IDs.
|
||||||
class Scene_item_print_interface {
|
class Scene_item_print_interface {
|
||||||
public:
|
public:
|
||||||
virtual ~Scene_item_print_interface(){}
|
virtual ~Scene_item_print_interface(){}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue