All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DisplayOutside.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2001-2014 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file DisplayOutside.cpp
22 
23  \brief
24 
25  \ingroup layout
26 */
27 
28 // TerraLib
29 #include "DisplayOutside.h"
30 #include "Context.h"
31 #include "AbstractScene.h"
32 #include "Scene.h"
33 #include "OutsideModelObservable.h"
34 #include "ItemObserver.h"
35 #include "OutsideObserver.h"
36 #include "OutsideController.h"
37 #include "../../../../geometry/Envelope.h"
38 
39 // Qt
40 #include <QGraphicsWidget>
41 #include <QMainWindow>
42 
44  QDockWidget("", 0, 0),
45  OutsideObserver(controller, o),
46  m_previousCentralWidget(0)
47 {
48  setVisible(false);
49  setWindowTitle("Layout Display");
50 }
51 
53 {
54 
55 }
56 
58 {
59  setVisible(context.getShow());
60  if(context.getShow() == true)
61  show();
62  else
63  hide();
64 }
65 
66 void te::layout::DisplayOutside::setPosition( const double& x, const double& y )
67 {
68  move(x,y);
69  refresh();
70 }
71 
73 {
74  QPointF posF = pos();
75  qreal valuex = posF.x();
76  qreal valuey = posF.y();
77 
78  te::gm::Coord2D coordinate;
79  coordinate.x = valuex;
80  coordinate.y = valuey;
81 
82  return coordinate;
83 }
84 
85 void te::layout::DisplayOutside::closeEvent( QCloseEvent * event )
86 {
87  QDockWidget::closeEvent(event);
88 
89  if(widget())
90  {
91  widget()->close();
92  }
93 
94  removeDock();
95 }
96 
98 {
99  m_previousCentralWidget = previous;
100 }
101 
103 {
104  QMainWindow* mw = (QMainWindow*)parentWidget();
105 
106  if(mw)
107  {
108  mw->removeDockWidget(this);
109  if(m_previousCentralWidget)
110  {
111  QDockWidget* dock = dynamic_cast<QDockWidget*>(m_previousCentralWidget);
112  if(dock)
113  {
114  mw->setCentralWidget(dock);
115  dock->setVisible(m_previousCentralWidgetVisibilite);
116  }
117  }
118  }
119 }
virtual void setPosition(const double &x, const double &y)
double y
y-coordinate.
Definition: Coord2D.h:87
void setPreviousCentralWidget(QWidget *previous)
double x
x-coordinate.
Definition: Coord2D.h:86
virtual te::gm::Coord2D getPosition()
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
DisplayOutside(OutsideController *controller, Observable *o)
virtual void updateObserver(ContextItem context)
virtual void closeEvent(QCloseEvent *event)