All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GridModel.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 GridModel.cpp
22 
23  \brief
24 
25  \ingroup layout
26 */
27 
28 // TerraLib
29 #include "GridModel.h"
30 #include "../core/ContextItem.h"
31 #include "../../geometry/Envelope.h"
32 #include "../../geometry/Coord2D.h"
33 #include "../core/property/Property.h"
34 #include "../../srs/Config.h"
35 #include "../core/enum/Enums.h"
36 
38  m_name("GRID_MODEL"),
39  m_srid(TE_UNKNOWN_SRS),
40  m_systematic(0),
41  m_mapDisplacementX(0),
42  m_mapDisplacementY(0),
43  m_visible(false),
44  m_lneHrzGap(0),
45  m_lneVrtGap(0),
46  m_initialGridPointX(0),
47  m_initialGridPointY(0),
48  m_gridStyle(0),
49  m_lineStyle(0),
50  m_lineWidth(1),
51  m_pointTextSize(12),
52  m_fontText("Arial"),
53  m_visibleAllTexts(true),
54 
55  m_superscriptText(false),
56  m_lneVrtDisplacement(7),
57  m_lneHrzDisplacement(7),
58  m_bottomText(true),
59  m_leftText(true),
60  m_rightText(true),
61  m_topText(true),
62  m_bottomRotateText(false),
63  m_leftRotateText(false),
64  m_rightRotateText(false),
65  m_topRotateText(false)
66 {
67  m_gridStyle = Enums::getInstance().getEnumGridStyleType()->getStyleNone();
68  m_lineStyle = Enums::getInstance().getEnumLineStyleType()->getStyleNone();
69 }
70 
72 {
73  gridTextFreeMemory();
74 }
75 
77 {
78  return m_name;
79 }
80 
81 void te::layout::GridModel::setName( std::string name )
82 {
83  m_name = name;
84 }
85 
87 {
88  return m_visible;
89 }
90 
92 {
93  m_visible = visible;
94 }
95 
97 {
98  m_mapScale = scale;
99 }
100 
102 {
103  m_worldBox = box;
104 }
105 
107 {
108  m_boxMapMM = box;
109 }
110 
112 {
113  m_boundingBoxItemMM = box;
114 }
115 
117 {
118  m_systematic = sys;
119 }
120 
122 {
123  m_visibleAllTexts = visible;
124 
125  m_bottomText = visible;
126  m_leftText = visible;
127  m_rightText = visible;
128  m_topText = visible;
129 }
130 
132 {
133  return m_visibleAllTexts;
134 }
135 
137 {
138  std::map<te::gm::Point*, std::string>::iterator it;
139  for(it = m_gridTexts.begin() ; it != m_gridTexts.end() ; ++it)
140  {
141  te::gm::Point* p = it->first;
142  if(p)
143  {
144  delete p;
145  p = 0;
146  }
147  }
148  m_gridTexts.clear();
149 }
150 
151 std::map<te::gm::Point*, std::string> te::layout::GridModel::getGridInfo()
152 {
153  return m_gridTexts;
154 }
155 
157 {
158  m_mapDisplacementX = displacement;
159 }
160 
162 {
163  m_mapDisplacementY = displacement;
164 }
165 
167 {
168  return m_pointTextSize;
169 }
170 
172 {
173  return m_fontText;
174 }
EnumType * m_gridStyle
Definition: GridModel.h:131
virtual int getPointSize()
Definition: GridModel.cpp:166
EnumType * m_lineStyle
Definition: GridModel.h:134
virtual void setMapDisplacementX(double displacement)
Definition: GridModel.cpp:156
virtual std::string getName()
Definition: GridModel.cpp:76
virtual void setVisible(bool visible)
Definition: GridModel.cpp:91
virtual void setMapDisplacementY(double displacement)
Definition: GridModel.cpp:161
virtual void setName(std::string name)
Definition: GridModel.cpp:81
virtual void setSystematic(Systematic *sys)
Definition: GridModel.cpp:116
virtual void setWorldBox(te::gm::Envelope box)
Definition: GridModel.cpp:101
virtual void gridTextFreeMemory()
Definition: GridModel.cpp:136
static Enums & getInstance()
It returns a reference to the singleton instance.
A point with x and y coordinate values.
Definition: Point.h:50
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
Definition: Config.h:44
virtual void setMapScale(double scale)
Definition: GridModel.cpp:96
virtual bool isVisibleAllTexts()
Definition: GridModel.cpp:131
virtual void setBoxMapMM(te::gm::Envelope box)
Definition: GridModel.cpp:106
virtual bool isVisible()
Definition: GridModel.cpp:86
virtual void setBoundingBoxItemMM(te::gm::Envelope box)
Definition: GridModel.cpp:111
virtual std::string getFontFamily()
Definition: GridModel.cpp:171
virtual std::map< te::gm::Point *, std::string > getGridInfo()
Definition: GridModel.cpp:151
virtual void setVisibleAllTexts(bool visible)
Definition: GridModel.cpp:121