All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PaperModel.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 PaperModel.cpp
22 
23  \brief
24 
25  \ingroup layout
26 */
27 
28 // TerraLib
29 #include "PaperModel.h"
30 #include "../core/ContextItem.h"
31 #include "../../maptools/Canvas.h"
32 #include "../core/enum/Enums.h"
33 
35  m_paperConfig(0)
36 {
37  m_type = Enums::getInstance().getEnumObjectType()->getPaperItem();
38 
39  m_shadowPadding = 10.;
40 
41  m_paperColor = te::color::RGBAColor(255, 255, 255, 255);
42  m_shadowColor = te::color::RGBAColor(0, 0, 0, 255);
43 
44  m_borderColor = te::color::RGBAColor(255, 255, 255, 0);
45 
46  m_border = false;
47 
48  config();
49 }
50 
52  m_paperConfig(paperConfig)
53 {
54  m_type = Enums::getInstance().getEnumObjectType()->getPaperItem();
55 
56  m_shadowPadding = 10.;
57 
58  m_paperColor = te::color::RGBAColor(255, 255, 255, 255);
59  m_shadowColor = te::color::RGBAColor(0, 0, 0, 255);
60 
61  m_borderColor = te::color::RGBAColor(255, 255, 255, 0);
62 
63  m_border = false;
64 
65  config();
66 }
67 
69 {
70 
71 }
72 
74 {
75  if(!m_paperConfig)
76  return;
77 
78  double pw = 0.;
79  double ph = 0.;
80 
81  m_paperConfig->getPaperSize(pw, ph);
82  m_box = te::gm::Envelope(0., - m_shadowPadding, pw + m_shadowPadding, ph);
83 
84  ContextItem context;
85  context.setChangePos(true);
86 
87  te::gm::Coord2D coord(m_box.m_llx, m_box.m_lly);
88  context.setPos(coord);
89 
90  notifyAll(context);
91 }
92 
94 {
95  return m_shadowColor;
96 }
97 
99 {
100  m_shadowColor = color;
101 }
102 
104 {
105  m_paperConfig = pConfig;
106  config();
107 }
108 
110 {
111  return m_paperConfig;
112 }
113 
115 {
116  m_shadowPadding = padding;
117 }
118 
120 {
121  return m_shadowPadding;
122 }
123 
125 {
126  if(!m_paperConfig)
127  return;
128 
129  double pw = 0.;
130  double ph = 0.;
131 
132  m_paperConfig->getPaperSize(pw, ph);
133  m_box = te::gm::Envelope(box.m_llx, box.m_lly - m_shadowPadding, pw + m_shadowPadding, ph);
134 }
135 
137 {
138  return m_paperColor;
139 }
140 
142 {
143  m_paperColor = color;
144 }
Class responsible for maintaining the drawing context of a MVC component. It is always used by the "M...
Definition: ContextItem.h:49
Class responsible for paper setting. Size, orientation, custom size, etc.
Definition: PaperConfig.h:45
Class that represents a "Model" part of Paper MVC component. Its coordinate system is the same of sce...
virtual ~PaperModel()
Destructor.
Definition: PaperModel.cpp:68
virtual void setPaperColor(te::color::RGBAColor color)
Definition: PaperModel.cpp:141
virtual void setBox(te::gm::Envelope box)
Change the bounding rectangle.
Definition: PaperModel.cpp:124
bool m_border
true if should be drawn border, false otherwise
virtual void setShadowPadding(double padding)
Definition: PaperModel.cpp:114
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
EnumType * m_type
type of the MVC component
virtual void setShadowColor(te::color::RGBAColor color)
Definition: PaperModel.cpp:98
te::color::RGBAColor m_shadowColor
Definition: PaperModel.h:95
void setPos(te::gm::Coord2D pos)
virtual void setPaperConfig(PaperConfig *pConfig)
Definition: PaperModel.cpp:103
double m_llx
Lower left corner x-coordinate.
Definition: Envelope.h:344
static Enums & getInstance()
It returns a reference to the singleton instance.
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
virtual void config()
Definition: PaperModel.cpp:73
void setChangePos(bool change)
virtual te::color::RGBAColor getPaperColor()
Definition: PaperModel.cpp:136
double m_lly
Lower left corner y-coordinate.
Definition: Envelope.h:345
virtual double getShadowPadding()
Definition: PaperModel.cpp:119
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
virtual te::color::RGBAColor getShadowColor()
Definition: PaperModel.cpp:93
PaperModel()
Constructor.
Definition: PaperModel.cpp:34
te::color::RGBAColor m_paperColor
Definition: PaperModel.h:97
virtual PaperConfig * getPaperConfig() const
Definition: PaperModel.cpp:109
te::color::RGBAColor m_borderColor
border color