20#ifndef Tulip_GLMAINVIEW_H
21#define Tulip_GLMAINVIEW_H
23#include <tulip/ViewWidget.h>
24#include <tulip/GlMainWidget.h>
26class QGraphicsProxyWidget;
32class GlOverviewGraphicsItem;
33class SceneConfigWidget;
34class SceneLayersConfigWidget;
36class ViewActionsManager;
73 tlp::GlOverviewGraphicsItem *_overviewItem;
74 tlp::ViewActionsManager *_viewActionsManager;
76 QPushButton *_showOvButton, *_showQabButton;
79 bool needQuickAccessBar, _needTooltipAndUrlManager;
80 QGraphicsProxyWidget *_quickAccessBarItem;
81 tlp::QuickAccessBar *_quickAccessBar;
82 tlp::SceneConfigWidget *_sceneConfigurationWidget;
83 tlp::SceneLayersConfigWidget *_sceneLayersConfigurationWidget;
86 enum OverviewPosition {
93 GlMainView(
bool needTooltipAndUrlManager =
false);
94 ~GlMainView()
override;
97 bool overviewVisible()
const;
98 bool quickAccessBarVisible()
const;
99 QPixmap
snapshot(
const QSize &outputSize = QSize())
const override;
101 void setOverviewPosition(
const OverviewPosition &position);
102 OverviewPosition overviewPosition()
const;
104 void setUpdateOverview(
bool updateOverview);
105 bool updateOverview()
const;
117 getGlMainWidget()->getScene()->rotateCamera(x, y, z);
127 getGlMainWidget()->getScene()->translateCamera(x, y, z);
134 return getGlMainWidget()->getScene()->getGraphCamera().viewportTo3DWorld(vpos);
141 return getGlMainWidget()->getScene()->getGraphCamera().worldTo2DViewport(wpos);
148 inline void zoomXY(
int step,
const int x,
const int y) {
149 getGlMainWidget()->getScene()->zoomXY(step, x, y);
157 getGlMainWidget()->getScene()->zoom(step);
165 getGlMainWidget()->getScene()->zoomFactor(factor);
225 void undoCallback()
override;
229 bool getNodeOrEdgeAtViewportPos(
int x,
int y,
node &n,
edge &e)
const override {
230 return getNodeOrEdgeAtViewportPos(_glMainWidget, x, y, n, e);
240 virtual void sceneRectChanged(
const QRectF &);
241 void fillContextMenu(QMenu *menu,
const QPointF &)
override;
245 void assignNewGlMainWidget(
GlMainWidget *glMainWidget,
bool deleteOldGlMainWidget =
true);
246 bool eventFilter(QObject *obj, QEvent *event)
override;
248 tlp::GlOverviewGraphicsItem *overviewItem()
const;
249 void updateShowOverviewButton();
250 void updateShowQuickAccessBarButton();
251 virtual QuickAccessBar *getQuickAccessBarImpl();
253 OverviewPosition _overviewPosition;
255 bool _updateOverview;
A container that can store data from any type.
tlp::DataSet state() const override
Backup the state of the view. This method is used to restore the View's parameters when it's re-opene...
void setupWidget() override
Sets up the central widget. This is similar to View::setupUi in the sense that the purpose of setupWi...
void refresh() override
Calls GlMainWidget::redraw();.
QPixmap snapshot(const QSize &outputSize=QSize()) const override
Takes a snapshot of the view's screen and saves it into the given pixmap. The snapshot is scaled to o...
void setOverviewVisible(bool)
Toggles the overview on or off.
Coord viewToWorld(const Coord &vpos) const
Return the 3D world position for the given view position.
void setQuickAccessBarVisible(bool)
allows to control the quick access bar visibility
void redraw()
Calls GlMainWidget::redraw();.
virtual void drawOverview(bool generatePixmap=true)
Force the overview to be redrawn. Since GlMainView already detects graph's modifications,...
void setViewOrtho(bool)
Toggles the orthogonal projection on or off, then draws.
void zoomFactor(float factor)
Zoom by factor.
void rotateCamera(int x, int y, int z)
Rotate the view camera by (x,y,z).
Coord worldToView(const Coord &wpos) const
Return the view position for the given 3D position.
void zoomXY(int step, const int x, const int y)
Zoom by step to the given (x,y) view position.
void draw() override
Calls GlMainWidget::draw();.
void centerView(bool graphChanged=false) override
Centers the scene's camera.
void zoom(int step)
Zoom by step.
std::list< QWidget * > configurationWidgets() const override
void zoomAndPanAnimation(const tlp::BoundingBox &boundingBox, const double duration=1000.)
Do a zoom and pan animation.
void translateCamera(int x, int y, int z)
Translate the view camera by (x,y,z).
QImage getRGBImage() const
Return the glMainWidget current display in the RGB888 format.
void applySettings() override
Force the settings set in the configuration widgets to be re-applied.
void setState(const tlp::DataSet &) override
Restores the state of the view. DataSet passed down to this method can come from a previous backup or...
This widget provide a simple system to visualize data/graph with OpenGL 3D engine.
virtual void graphChanged(tlp::Graph *)=0
Callback method after setGraph() was called. At this point, a call to View::graph() is considered val...
This class represents the 3D bounding box of an object. It is mostly used to determine whether or not...
The edge struct represents an edge in a Graph object.
The node struct represents a node in a Graph object.