1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
// Copyright (c) 2018 GeometryFactory Sarl (France)
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
//
// $URL: https://github.com/CGAL/cgal/blob/v6.1/Three/include/CGAL/Three/Three.h $
// $Id: include/CGAL/Three/Three.h b26b07a1242 $
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Maxime GIMENO
#ifndef THREE_H
#define THREE_H
#include <CGAL/license/Three.h>
#include <QString>
#include <QObject>
#include <QDockWidget>
#include <CGAL/Three/Scene_interface.h>
#include <CGAL/Three/Viewer_interface.h>
#include <QMainWindow>
#include <QApplication>
#include <QMutex>
#include <QWaitCondition>
#ifdef three_EXPORTS
# define THREE_EXPORT Q_DECL_EXPORT
#else
# define THREE_EXPORT Q_DECL_IMPORT
#endif
#define CGAL_QT_SKIP_EMPTY_PARTS ::Qt::SkipEmptyParts
namespace CGAL{
namespace Three{
struct OverrideCursorScopeGuard
{
OverrideCursorScopeGuard(QCursor cursor) { QApplication::setOverrideCursor(cursor); }
~OverrideCursorScopeGuard() { QApplication::restoreOverrideCursor(); }
};
class CGAL_Lab_plugin_interface;
class THREE_EXPORT Three{
public:
using CursorScopeGuard = CGAL::Three::OverrideCursorScopeGuard; // for compatibility
Three();
virtual ~Three(){}
static QMainWindow* mainWindow();
static Viewer_interface* mainViewer();
static Viewer_interface* currentViewer();
static void setCurrentViewer(CGAL::Three::Viewer_interface* viewer);
static Viewer_interface* activeViewer();
static Scene_interface* scene();
static QObject* connectableScene();
static RenderingMode defaultSurfaceMeshRenderingMode();
static RenderingMode defaultPointSetRenderingMode();
static QString modeName(RenderingMode mode);
static RenderingMode modeFromName(QString name);
static int getDefaultPointSize();
static int getDefaultNormalLength();
static int getDefaultLinesWidth();
static bool &isLocked();
static QMutex *getMutex();
static QWaitCondition* getWaitCondition();
/*! \brief Adds a dock widget to the interface
*
* Adds a dock widget in the left section of the MainWindow. If the slot is already
* taken, the dock widgets will be tabified.
*/
void addDockWidget(QDockWidget* dock_widget);
/*! \brief gets an item of the templated type.
* \returns the first `SceneType` item found in the scene's list of currently selected
* items;
* \returns nullptr if there is no `SceneType` in the list.
*/
template<class SceneType>
static SceneType* getSelectedItem();
/*! \brief Automatically connects each action of `plugin` to the corresponding slot.
*
* \attention Each action named `ActionName` in the plugin's `actions()` list must have
* a corresponding slot named `on_ActionsName_triggered()`
* in the plugin.
*/
static void autoConnectActions(CGAL::Three::CGAL_Lab_plugin_interface* plugin);
/*!
* Displays in the console a blue text preceded by the mention
* "INFO: ".
*/
static void information(QString);
/*!
* Displays in the console an orange text preceded by the mention "WARNING: ".
*/
static void warning(QString);
/*!
* Displays in the console a red text preceded by the mention "ERROR: ".
*/
static void error(QString);
/*!
* Displays an information popup.
*/
static void information(QString title, QString message);
/*!
* Displays a warning popup.
*/
static void warning(QString title, QString message);
/*!
* Displays an error popup.
*/
static void error(QString title, QString message);
static void lock_test_item(bool b);
protected:
static QMainWindow* s_mainwindow;
static Viewer_interface* s_mainviewer;
static Viewer_interface* s_currentviewer;
static Scene_interface* s_scene;
static QObject* s_connectable_scene;
static Three* s_three;
static RenderingMode s_defaultSMRM;
static RenderingMode s_defaultPSRM;
static int default_point_size;
static int default_normal_length;
static int default_lines_width;
static QMutex* s_mutex;
static QWaitCondition* s_wait_condition;
static bool s_is_locked;
};
}
}
#endif // THREE_H
|