The scene performs a check on the item to insure it is able to display its primitive IDs.

This commit is contained in:
Maxime Gimeno 2016-02-08 15:29:30 +01:00
parent 845a9c7bac
commit 8a155b4f5d
3 changed files with 15 additions and 4 deletions

View File

@ -5,6 +5,7 @@
#include "config.h"
#include "Scene.h"
#include <CGAL/Three/Scene_item.h>
#include <CGAL/Three/Scene_item_print_interface.h>
#include <QObject>
#include <QMetaObject>
@ -1141,13 +1142,23 @@ void Scene::printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface* viewer
{
Scene_item *it = item(mainSelectionIndex());
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)
{
Scene_item *it = item(mainSelectionIndex());
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)
{

View File

@ -47,7 +47,7 @@ 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, CGAL::Three::Scene_item_print_interface {
class SCENE_ITEM_EXPORT Scene_item : public QObject, public CGAL::Three::Scene_item_print_interface {
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor)
Q_PROPERTY(QString name READ name WRITE setName)

View File

@ -26,7 +26,7 @@ namespace Three {
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 {
public:
virtual ~Scene_item_print_interface(){}