All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Context.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 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 Context.cpp
22 
23  \brief
24 
25  \ingroup layout
26 */
27 
28 // TerraLib
29 #include "Context.h"
30 #include "../factory/AbstractItemFactory.h"
31 #include "../../Utils.h"
32 #include "../factory/AbstractOutsideFactory.h"
33 #include "../../../../maptools/Canvas.h"
34 #include "../../../../geometry/Envelope.h"
35 #include "../../enum/Enums.h"
36 #include "../proxy/AbstractProxyProject.h"
37 
39  m_mode(0),
40  m_lineIntersectionMouseMode(0),
41  m_scene(0),
42  m_zoomFactor(1.),
43  m_defaultZoomFactor(0.5),
44  m_oldZoomFactor(1.),
45  m_canvas(0),
46  m_itemFactory(0),
47  m_outsideFactory(0),
48  m_templateFactory(0),
49  m_utils(0),
50  m_dpiX(96),
51  m_dpiY(96),
52  m_version("MAPLayoutQt5_1.0.0"),
53  m_paperConfig(0),
54  m_buildGraphicsItem(0),
55  m_systematicConfig(0),
56  m_proxyProject(0),
57  m_itemUtils(0),
58  m_wait(0),
59  m_item(0),
60  m_buildGraphicsOutside(0)
61 {
62  EnumModeType* type = Enums::getInstance().getEnumModeType();
63  if(type)
64  {
65  m_mode = type->getModeNone();
67  }
68 }
69 
71 {
72 
73 }
74 
76 {
77  if(!m_mode)
78  {
80  if(type)
81  {
82  m_mode = type->getModeNone();
83  }
84  }
85  return m_mode;
86 }
87 
89 {
90  return m_scene;
91 }
92 
94 {
95  m_mode = mode;
96 }
97 
99 {
100  m_scene = scene;
101 }
102 
104 {
105  return m_zoomFactor;
106 }
107 
108 void te::layout::Context::setZoomFactor( double zoomFactor )
109 {
110  m_zoomFactor = zoomFactor;
111 }
112 
114 {
115  return m_itemFactory;
116 }
117 
119 {
120  m_itemFactory = factory;
121 }
122 
124 {
125  return m_outsideFactory;
126 }
127 
129 {
130  m_outsideFactory = factory;
131 }
132 
134 {
135  return m_templateFactory;
136 }
137 
139 {
140  m_templateFactory = factory;
141 }
142 
144 {
145  return m_canvas;
146 }
147 
149 {
150  m_canvas = canvas;
151 }
152 
154 {
155  return m_utils;
156 }
157 
159 {
160  m_utils = utils;
161 }
162 
163 te::layout::LayoutUnitsMetrics te::layout::Context::getUnitMetric()
164 {
165  return m_unitMetric;
166 }
167 
168 void te::layout::Context::setUnitMetric( LayoutUnitsMetrics unit )
169 {
170  m_unitMetric = unit;
171 }
172 
174 {
175  return m_dpiX;
176 }
177 
178 void te::layout::Context::setDpiX( double dpiX )
179 {
180  m_dpiX = dpiX;
181 }
182 
184 {
185  return m_dpiY;
186 }
187 
188 void te::layout::Context::setDpiY( double dpiY )
189 {
190  m_dpiY = dpiY;
191 }
192 
194 {
195  return m_version;
196 }
197 
199 {
200  return m_paperConfig;
201 }
202 
204 {
205  m_paperConfig = config;
206 }
207 
209 {
210  return m_buildGraphicsItem;
211 }
212 
214 {
215  m_buildGraphicsItem = build;
216 }
217 
219 {
220  return m_lineIntersectionMouseMode;
221 }
222 
224 {
225  m_lineIntersectionMouseMode = mode;
226 }
227 
229 {
230  return m_defaultZoomFactor;
231 }
232 
234 {
235  m_defaultZoomFactor = zoomFactor;
236 }
237 
239 {
240  return m_oldZoomFactor;
241 }
242 
243 void te::layout::Context::setOldZoomFactor( double zoomFactor )
244 {
245  m_oldZoomFactor = zoomFactor;
246 }
247 
249 {
250  return m_systematicConfig;
251 }
252 
254 {
255  m_systematicConfig = scale;
256 }
257 
259 {
260  m_proxyProject = project;
261 }
262 
264 {
265  return m_proxyProject;
266 }
267 
269 {
270  m_itemUtils = utils;
271 }
272 
274 {
275  return m_itemUtils;
276 }
277 
279 {
280  return m_wait;
281 }
282 
284 {
285  m_wait = wait;
286 }
287 
289 {
290  return m_item;
291 }
292 
294 {
295  m_item = item;
296 }
297 
299 {
300  return m_buildGraphicsOutside;
301 }
302 
304 {
305  m_buildGraphicsOutside = build;
306 }
307 
308 
309 
void setPaperConfig(PaperConfig *config)
Change paper setting.
Definition: Context.cpp:203
Abstract Factory provide an interface for creating families of related or dependent graphic objects (...
LayoutUnitsMetrics getUnitMetric()
Definition: Context.cpp:163
double getOldZoomFactor()
Returns previous zoom factor. Ex.: 0.5 (50%)
Definition: Context.cpp:238
AbstractOutsideFactory * getOutsideFactory()
Returns Abstract Factory provide an interface for creating families of related or dependent graphic w...
Definition: Context.cpp:123
void setDpiY(double dpiY)
Definition: Context.cpp:188
Class responsible for paper setting. Size, orientation, custom size, etc.
Definition: PaperConfig.h:45
void setItemUtils(ItemUtils *utils)
Change pointer for manipulating items in the scene and vectorization of text and legend.
Definition: Context.cpp:268
void setScene(AbstractScene *scene)
Change scene, QGraphicsScene class, part of Graphics View Framework.
Definition: Context.cpp:98
virtual EnumModeType * getEnumModeType()
Returns mode type enumeration.
Definition: Enums.cpp:92
void setUnitMetric(LayoutUnitsMetrics unit)
Definition: Context.cpp:168
void setZoomFactor(double zoomFactor)
Change current zoom factor. Ex.: 0.5 (50%)
Definition: Context.cpp:108
void setAbstractBuildGraphicsItem(AbstractBuildGraphicsItem *build)
Change a pointer for build graphics MVC components.
Definition: Context.cpp:213
void setSystematicScaleConfig(SystematicScaleConfig *scale)
Definition: Context.cpp:253
Abstract Factory provide an interface for creating families of related or dependent templates without...
void setItemFactory(AbstractItemFactory *factory)
Change factory for creating families of related or dependent graphic objects (MVC components)...
Definition: Context.cpp:118
Singleton class responsible for keeping active objects while the plugin is loaded in memory and make ...
Abstract class to represent an observer. "View" part of MVC component. All classes representing the g...
Definition: ItemObserver.h:52
void setDpiX(double dpiX)
Definition: Context.cpp:178
ItemObserver * getItem()
Definition: Context.cpp:288
Abstract class for build MVC widgets.
void setAbstractBuildGraphicsOutside(AbstractBuildGraphicsOutside *build)
Change a pointer for build graphics MVC components.
Definition: Context.cpp:303
double getDefaultZoomFactor()
Default zoom factor. Ex.: 0.5 (50%)
Definition: Context.cpp:228
void setItem(ItemObserver *item)
Definition: Context.cpp:293
static Enums & getInstance()
It returns a reference to the singleton instance.
Class to represent a mode type enumeration. Ex.: select, pan, create text, etc. The type of mode is u...
Definition: EnumModeType.h:50
AbstractProxyProject * getProxyProject()
Returns proxy to provide a surrogate or placeholder for te::qt::af::Project to control access to it...
Definition: Context.cpp:263
EnumType * getWait()
Definition: Context.cpp:278
virtual EnumType * getModeNone() const
Returns value that represents none mode type belonging to enumeration.
EnumType * m_mode
value of the enumeration of mode type
Definition: Context.h:352
virtual EnumType * getModeOffLinesIntersectionMouse() const
Returns value that represents off lines intersection mouse mode type belonging to enumeration...
Utils * getUtils()
Returns pointer with functions to manipulate the canvas and conversion between projections.
Definition: Context.cpp:153
ItemUtils * getItemUtils()
Returns pointer for manipulating items in the scene and vectorization of text and legend...
Definition: Context.cpp:273
Context()
Constructor.
Definition: Context.cpp:38
EnumType * getMode()
Returns value of the enumeration of mode type.
Definition: Context.cpp:75
AbstractBuildGraphicsItem * getAbstractBuildGraphicsItem()
Returns pointer for build graphics MVC components.
Definition: Context.cpp:208
AbstractItemFactory * getItemFactory()
Returns Abstract Factory that provide an interface for creating families of related or dependent grap...
Definition: Context.cpp:113
Utility class for manipulating items in the scene and vectorization of text and legend.
Definition: ItemUtils.h:62
EnumType * m_lineIntersectionMouseMode
Definition: Context.h:353
Abstract scene for Scene, a QGraphicsScene class, part of Graphics View Framework.
Definition: AbstractScene.h:48
void setOutsideFactory(AbstractOutsideFactory *factory)
Change factory provide an interface for creating families of related or dependent graphic widgets (MV...
Definition: Context.cpp:128
void setCanvas(te::map::Canvas *canvas)
Change abstraction of a drawing area.
Definition: Context.cpp:148
SystematicScaleConfig * getSystematicScaleConfig()
Definition: Context.cpp:248
AbstractBuildGraphicsOutside * getAbstractBuildGraphicsOutside()
Returns pointer for build graphics MVC components.
Definition: Context.cpp:298
Abstract class to provide a surrogate or placeholder for te::qt::af::Project to control access to it...
AbstractTemplateFactory * getTemplateFactory()
Returns Abstract Factory provide an interface for creating families of related or dependent templates...
Definition: Context.cpp:133
A canvas is an abstraction of a drawing area.
Definition: Canvas.h:91
virtual ~Context()
Destructor.
Definition: Context.cpp:70
void setWait(EnumType *wait)
Definition: Context.cpp:283
void setProxyProject(AbstractProxyProject *project)
Change the proxy to provide a surrogate or placeholder for te::qt::af::Project to control access to i...
Definition: Context.cpp:258
Class that represents the value of an enumeration. An enumeration is made of "1..n" objects EnumType...
Definition: EnumType.h:48
Abstract Factory provide an interface for creating families of related or dependent graphic widgets (...
void setUtils(Utils *utils)
Change pointer with functions to manipulate the canvas and conversion between projections.
Definition: Context.cpp:158
EnumType * getLineIntersectionMouseMode()
Definition: Context.cpp:218
void setDefaultZoomFactor(double zoomFactor)
Change default zoom factor. Ex.: 0.5 (50%)
Definition: Context.cpp:233
void setMode(EnumType *mode)
Change value of the enumeration of mode type. Ex.: select, pan, create text, etc. The type of mode is...
Definition: Context.cpp:93
std::string getVersion()
Template structure version.
Definition: Context.cpp:193
AbstractScene * getScene()
Returns abstract scene for QGraphicsScene class, part of Graphics View Framework. ...
Definition: Context.cpp:88
PaperConfig * getPaperConfig() const
Returns paper setting.
Definition: Context.cpp:198
Abstract class for build graphics MVC components.
double getZoomFactor()
Returns current zoom factor. Ex.: 0.5 (50%)
Definition: Context.cpp:103
void setOldZoomFactor(double zoomFactor)
Change previous zoom factor. Ex.: 0.5 (50%)
Definition: Context.cpp:243
Utility class with functions to manipulate the canvas and conversion between projections.
Definition: Utils.h:61
te::map::Canvas * getCanvas()
Returns abstraction of a drawing area.
Definition: Context.cpp:143
void setLineIntersectionMouseMode(EnumType *mode)
Definition: Context.cpp:223
void setTemplateFactory(AbstractTemplateFactory *factory)
Change factory provide an interface for creating families of related or dependent templates...
Definition: Context.cpp:138