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) 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 Context.cpp
22 
23  \brief
24 
25  \ingroup layout
26 */
27 
28 // TerraLib
29 #include "Context.h"
30 #include "AbstractItemFactory.h"
31 #include "Utils.h"
32 #include "AbstractOutsideFactory.h"
33 #include "../../../../../maptools/Canvas.h"
34 #include "../../../../../geometry/Envelope.h"
35 
36 // STL
37 #include <stddef.h> // defines NULL
38 
39 // Global static pointer used to ensure a single instance of the class.
41 
42 /** This function is called to create an instance of the class.
43 Calling the constructor publicly is not allowed. The constructor
44 is private and is only called by this Instance function.
45 */
47 {
48  if(!_instance)
49  {
50  _instance = new Context;
51  return _instance;
52  }
53  return _instance;
54 }
55 
57 {
58  return m_mode;
59 }
60 
62 {
63  return m_scene;
64 }
65 
67 {
68  m_mode = mode;
69 }
70 
72 {
73  m_scene = scene;
74 }
75 
77 {
78  return m_zoomFactor;
79 }
80 
81 void te::layout::Context::setZoomFactor( double zoomFactor )
82 {
83  m_zoomFactor = zoomFactor;
84 }
85 
87 {
88  return m_itemFactory;
89 }
90 
92 {
93  m_itemFactory = factory;
94 }
95 
97 {
98  return m_outsideFactory;
99 }
100 
102 {
103  m_outsideFactory = factory;
104 }
105 
107 {
108  return m_templateFactory;
109 }
110 
112 {
113  m_templateFactory = factory;
114 }
115 
117 {
118  return m_canvas;
119 }
120 
122 {
123  m_canvas = canvas;
124 }
125 
127 {
128  return m_utils;
129 }
130 
132 {
133  m_utils = utils;
134 }
135 
137 {
138  return m_unitMetric;
139 }
140 
142 {
143  m_unitMetric = unit;
144 }
145 
147 {
148  return m_dpiX;
149 }
150 
151 void te::layout::Context::setDpiX( double dpiX )
152 {
153  m_dpiX = dpiX;
154 }
155 
157 {
158  return m_dpiY;
159 }
160 
161 void te::layout::Context::setDpiY( double dpiY )
162 {
163  m_dpiY = dpiY;
164 }
165 
167 {
168  return m_version;
169 }
170 
172 {
173  return m_paperConfig;
174 }
175 
177 {
178  m_paperConfig = config;
179 }
180 
182 {
183  return m_buildGraphicsItem;
184 }
185 
187 {
188  m_buildGraphicsItem = build;
189 }
190 
192 {
193  return m_lineIntersectionMouseMode;
194 }
195 
197 {
198  m_lineIntersectionMouseMode = mode;
199 }
void setPaperConfig(PaperConfig *config)
Definition: Context.cpp:176
void setLineIntersectionMouseMode(LayoutMode mode)
Definition: Context.cpp:196
LayoutUnitsMetrics getUnitMetric()
Definition: Context.cpp:136
AbstractOutsideFactory * getOutsideFactory()
Definition: Context.cpp:96
void setDpiY(double dpiY)
Definition: Context.cpp:161
void setScene(AbstractScene *scene)
Definition: Context.cpp:71
void setUnitMetric(LayoutUnitsMetrics unit)
Definition: Context.cpp:141
void setZoomFactor(double zoomFactor)
Definition: Context.cpp:81
void setMode(LayoutMode mode)
Definition: Context.cpp:66
void setItemFactory(AbstractItemFactory *factory)
Definition: Context.cpp:91
LayoutMode
Enum LayoutMode. This is the enumeration of the components types.
Definition: EnumMode.h:38
void setDpiX(double dpiX)
Definition: Context.cpp:151
static Context * _instance
Definition: Context.h:71
Utils * getUtils()
Definition: Context.cpp:126
AbstractItemFactory * getItemFactory()
Definition: Context.cpp:86
void setOutsideFactory(AbstractOutsideFactory *factory)
Definition: Context.cpp:101
void setCanvas(te::map::Canvas *canvas)
Definition: Context.cpp:121
AbstractTemplateFactory * getTemplateFactory()
Definition: Context.cpp:106
A canvas is an abstraction of a drawing area.
Definition: Canvas.h:91
BuildGraphicsItem * getBuildGraphicsItem()
Definition: Context.cpp:181
void setUtils(Utils *utils)
Definition: Context.cpp:131
LayoutUnitsMetrics
Enum TdkAbstractComponentType. This is the enumeration of the components types.
Definition: AbstractType.h:122
std::string getVersion()
Definition: Context.cpp:166
AbstractScene * getScene()
Definition: Context.cpp:61
PaperConfig * getPaperConfig() const
Definition: Context.cpp:171
static Context * getInstance()
This function is called to create an instance of the class.
Definition: Context.cpp:46
double getZoomFactor()
Definition: Context.cpp:76
LayoutMode getLineIntersectionMouseMode()
Definition: Context.cpp:191
void setBuildGraphicsItem(BuildGraphicsItem *build)
Definition: Context.cpp:186
LayoutMode getMode()
Definition: Context.cpp:56
te::map::Canvas * getCanvas()
Definition: Context.cpp:116
void setTemplateFactory(AbstractTemplateFactory *factory)
Definition: Context.cpp:111