All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ObjectInspectorOutside.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 ObjectInspectorOutside.cpp
22 
23  \brief
24 
25  \ingroup layout
26 */
27 
28 // TerraLib
29 #include "ObjectInspectorOutside.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"
39 
40 //Qt
41 #include <QGraphicsWidget>
42 
44  QDockWidget("", 0, 0),
45  OutsideObserver(controller, o)
46 {
48  setBaseSize(box.getWidth(), box.getHeight());
49  setVisible(false);
50  setWindowTitle("Layout - Inspetor de Objetos");
51  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
52 
53  setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
54 
56 
58 }
59 
61 {
62 
63 }
64 
66 {
67  setVisible(context.getShow());
68  if(context.getShow() == true)
69  show();
70  else
71  hide();
72 }
73 
74 void te::layout::ObjectInspectorOutside::setPosition( const double& x, const double& y )
75 {
76  move(x,y);
77  refresh();
78 }
79 
81 {
82  QPointF posF = pos();
83  qreal valuex = posF.x();
84  qreal valuey = posF.y();
85 
86  te::gm::Coord2D coordinate;
87  coordinate.x = valuex;
88  coordinate.y = valuey;
89 
90  return coordinate;
91 }
92 
93 void te::layout::ObjectInspectorOutside::itemsInspector(QList<QGraphicsItem*> graphicsItems)
94 {
95  m_layoutPropertyBrowser->clearAll();
96 
97  m_graphicsItems = graphicsItems;
98 
99  if(m_graphicsItems.empty())
100  return;
101 
102  //QtVariantProperty *property;
103  foreach( QGraphicsItem *item, graphicsItems)
104  {
105  if (item)
106  {
107  QGraphicsWidget* outside = dynamic_cast<QGraphicsWidget*>(item);
108 
109  if(outside)
110  continue;
111 
112  int zValue = 0;
113 
114  QGraphicsItem* parentItem = item->parentItem();
115  zValue = item->zValue();
116 
117  ItemObserver* lItem = dynamic_cast<ItemObserver*>(item);
118  if(lItem)
119  {
120  Properties* properties = const_cast<Properties*>(lItem->getProperties());
121 
122  foreach(Property p, properties->getProperties())
123  {
124  QGraphicsObject* itemObj = dynamic_cast<QGraphicsObject*>(item);
125 
126  if(!itemObj)
127  break;
128 
129  zValue = itemObj->zValue();
130  }
131  }
132  }
133  }
134 
135  update();
136 }
virtual void itemsInspector(QList< QGraphicsItem * > graphicsItems)
double y
y-coordinate.
Definition: Coord2D.h:87
double x
x-coordinate.
Definition: Coord2D.h:86
QtTreePropertyBrowser * getPropertyEditor()
virtual te::gm::Envelope getBox()=0
double getWidth() const
It returns the envelope width.
Definition: Envelope.h:443
virtual std::vector< Property > getProperties()
Definition: Properties.h:116
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
virtual void setPosition(const double &x, const double &y)
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
ObjectInspectorOutside(OutsideController *controller, Observable *o)
virtual void updateObserver(ContextItem context)
virtual te::layout::Properties * getProperties() const
ObjectInspectorPropertyBrowser * m_layoutPropertyBrowser
double getHeight() const
It returns the envelope height.
Definition: Envelope.h:448