All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Context.h
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.h
22 
23  \brief
24 
25  \ingroup layout
26 */
27 
28 #ifndef __TERRALIB_LAYOUT_INTERNAL_CONTEXT_H
29 #define __TERRALIB_LAYOUT_INTERNAL_CONTEXT_H
30 
31 // TerraLib
32 #include "EnumMode.h"
33 #include "AbstractType.h"
34 #include "Utils.h"
35 #include "AbstractOutsideFactory.h"
36 #include "../../../../../maptools/Canvas.h"
37 #include "../../../../../geometry/Envelope.h"
38 
39 namespace te
40 {
41  namespace layout
42  {
43  class AbstractScene;
44  class AbstractItemFactory;
45  class AbstractOutsideFactory;
46  class AbstractTemplateFactory;
47  class PaperConfig;
48  class BuildGraphicsItem;
49 
50  class Context
51  {
52  private:
53  Context() :
55  m_scene(0),
56  m_canvas(0),
57  m_zoomFactor(1.),
58  m_itemFactory(0),
60  m_utils(0),
61  m_dpiX(96),
62  m_dpiY(96),
64  m_version("TerraPrintQt4_1.0.0"),
65  m_paperConfig(0),
68  {
69  }; // Private so that it can not be called
70  Context(Context const&){}; // copy constructor is private
71  Context& operator=(Context const&){}; // assignment operator is private
72  static Context* _instance;
73 
74  public:
75  virtual ~Context(){};
76  static Context* getInstance();
77 
79  void setMode(LayoutMode mode);
80 
83 
85  void setScene(AbstractScene* scene);
86 
87  double getZoomFactor();
88  void setZoomFactor(double zoomFactor);
89 
91  void setItemFactory(AbstractItemFactory* factory);
92 
95 
98 
100  void setBoxPaper(te::gm::Envelope* box);
101 
104 
106  void setCanvas(te::map::Canvas* canvas);
107 
108  Utils* getUtils();
109  void setUtils(Utils* utils);
110 
111  double getDpiX();
112  void setDpiX(double dpiX);
113 
114  double getDpiY();
115  void setDpiY(double dpiY);
116 
117  std::string getVersion();
118 
119  PaperConfig* getPaperConfig() const;
120  void setPaperConfig(PaperConfig* config);
121 
124 
127 
128  protected:
133  double m_zoomFactor;
139  double m_dpiX;
140  double m_dpiY;
141  std::string m_version;
144  };
145  }
146 }
147 
148 #endif
void setPaperConfig(PaperConfig *config)
Definition: Context.cpp:176
void setLineIntersectionMouseMode(LayoutMode mode)
Definition: Context.cpp:196
double m_zoomFactor
Definition: Context.h:133
AbstractScene * m_scene
Definition: Context.h:132
LayoutUnitsMetrics getUnitMetric()
Definition: Context.cpp:136
AbstractOutsideFactory * getOutsideFactory()
Definition: Context.cpp:96
void setDpiY(double dpiY)
Definition: Context.cpp:161
LayoutUnitsMetrics m_unitMetric
Definition: Context.h:131
LayoutAbstractPaperType
Enum TdkAbstractComponentType. This is the enumeration of the components types.
Definition: AbstractType.h:65
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
Context(Context const &)
Definition: Context.h:70
LayoutMode
Enum LayoutMode. This is the enumeration of the components types.
Definition: EnumMode.h:38
PaperConfig * m_paperConfig
Definition: Context.h:142
void setDpiX(double dpiX)
Definition: Context.cpp:151
static Context * _instance
Definition: Context.h:71
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
void setBoxPaper(te::gm::Envelope *box)
Utils * getUtils()
Definition: Context.cpp:126
Context & operator=(Context const &)
Definition: Context.h:71
std::string m_version
Definition: Context.h:141
BuildGraphicsItem * m_buildGraphicsItem
Definition: Context.h:143
void setTypePaper(LayoutAbstractPaperType type)
AbstractItemFactory * getItemFactory()
Definition: Context.cpp:86
te::map::Canvas * m_canvas
Definition: Context.h:134
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
AbstractTemplateFactory * m_templateFactory
Definition: Context.h:137
LayoutMode m_lineIntersectionMouseMode
Definition: Context.h:130
BuildGraphicsItem * getBuildGraphicsItem()
Definition: Context.cpp:181
AbstractOutsideFactory * m_outsideFactory
Definition: Context.h:136
void setUtils(Utils *utils)
Definition: Context.cpp:131
LayoutUnitsMetrics
Enum TdkAbstractComponentType. This is the enumeration of the components types.
Definition: AbstractType.h:122
AbstractItemFactory * m_itemFactory
Definition: Context.h:135
LayoutAbstractPaperType getTypePaper()
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
te::gm::Envelope * getBoxPaper()
void setBuildGraphicsItem(BuildGraphicsItem *build)
Definition: Context.cpp:186
LayoutMode getMode()
Definition: Context.cpp:56
LayoutMode m_mode
Definition: Context.h:129
te::map::Canvas * getCanvas()
Definition: Context.cpp:116
void setTemplateFactory(AbstractTemplateFactory *factory)
Definition: Context.cpp:111
virtual ~Context()
Definition: Context.h:75