Graphic.h
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 terralib/se/Graphic.h
22 
23  \brief A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
24 */
25 
26 #ifndef __TERRALIB_SE_INTERNAL_GRAPHIC_H
27 #define __TERRALIB_SE_INTERNAL_GRAPHIC_H
28 
29 // TerraLib
30 #include "Config.h"
31 
32 // STL
33 #include <vector>
34 
35 // Boost
36 #include <boost/noncopyable.hpp>
37 
38 namespace te
39 {
40  namespace se
41  {
42 // Forward declarations
43  class AnchorPoint;
44  class Displacement;
45  class ExternalGraphic;
46  class Mark;
47  class ParameterValue;
48 
49  /*!
50  \class Graphic
51 
52  \brief A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
53 
54  A graphic can be defined very informally as "a little picture" and
55  can be of either a raster or vector-graphic source type.
56  The default if neither an ExternalGraphic nor
57  a Mark is specified is to use the default mark
58  of a "square" with a 50%-gray fill and a black
59  outline, with a size of 6 pixels, unless an
60  explicit Size is specified.
61 
62  \ingroup se
63 
64  \sa Rule, PointSymbolizer, Stroke, GraphicStroke, Mark, ExternalGraphic, Displacement, ParameterValue, AnchorPoint
65  */
66  class TESEEXPORT Graphic : public boost::noncopyable
67  {
68  public:
69 
70  /** @name Initializer Methods
71  * Methods related to instantiation and destruction.
72  */
73  //@{
74 
75  /*! \brief It initializes a new Graphic. */
76  Graphic();
77 
78  /*! \brief Destructor. */
79  ~Graphic();
80 
81  //@}
82 
83  /** @name Accessor methods
84  * Methods used to get or set properties.
85  */
86  //@{
87 
88  /*!
89  \brief
90 
91  Graphics can either be referenced from an external URL
92  in a common format (such as GIF or SVG). Multiple
93  external URLs and marks may be referenced with the
94  semantic that they all provide the equivalent graphic
95  in different formats. The "hot spot" to use for positioning
96  the rendering at a point must either be inherent in the
97  external format or is defined to be the "central point" of
98  the graphic, where the exact definition "central point" is
99  system-dependent.
100  */
101  void add(ExternalGraphic* g);
102 
103  void setExternalGraphic(std::size_t index, ExternalGraphic* g);
104 
105  const std::vector<ExternalGraphic*> getExternalGraphics() const;
106 
107  /*!
108  \brief
109  */
110  void add(Mark* m);
111 
112  void setMark(std::size_t index, Mark* m);
113 
114  const std::vector<Mark*> getMarks() const;
115 
116  /*!
117  \brief
118 
119  The Opacity element gives the opacity to use
120  for rendering the graphic. It has the same
121  semantics as the "stroke-opacity" and "fill-opacity"
122  SvgParameter. The default value is 1.0.
123  */
124  void setOpacity(ParameterValue* value);
125 
126  const ParameterValue* getOpacity() const;
127 
128  /*!
129  \brief
130 
131  The Size element gives the absolute size of
132  the graphic in uoms encoded as a floating-point
133  number. The default size for an object is
134  context-dependent. Negative values are not allowed.
135 
136  The default size of an image format (such as GIF)
137  is the inherent size of the image. The
138  default size of a format without an
139  inherent size (such as SVG which are
140  not specially marked) is defined to be 16 pixels in
141  height and the corresponding aspect in width.
142  If a size is specified, the height of the graphic
143  will be scaled to that size and the corresponding
144  aspect will be used for the width. An expected common
145  use case will be for image graphics to be on the order
146  of 200 pixels in linear size and to be scaled to lower
147  sizes. On systems that can resample these graphic
148  images "smoothly", the results will be visually pleasing.
149  */
150  void setSize(ParameterValue* value);
151 
152  const ParameterValue* getSize() const;
153 
154  /*!
155  \brief
156 
157  The Rotation element gives the rotation of
158  a graphic in the clockwise direction about its
159  center point in decimal degrees, encoded as a
160  floating-point number. Negative values mean
161  counter-clockwise rotation. The default value
162  is 0.0 (no rotation). Note that there is no
163  connection between source geometry types and
164  rotations; the point used for plotting has no
165  inherent direction. Also, the point within the
166  graphic about which it is rotated is format
167  dependent. If a format does not include an
168  inherent rotation point, then the point of rotation
169  should be the centroid.
170  */
171  void setRotation(ParameterValue* value);
172 
173  const ParameterValue* getRotation() const;
174 
175  void setAnchorPoint(AnchorPoint* value);
176 
177  const AnchorPoint* getAnchorPoint() const;
178 
179  void setDisplacement(Displacement* value);
180 
181  const Displacement* getDisplacement() const;
182 
183  /*! \brief Clears the marks and the external graphics of this graphic. */
184  void clear();
185 
186  //@}
187 
188  /*! \brief It creates a new copy of this object. */
189  Graphic* clone() const;
190 
191  private:
192 
193  std::vector<ExternalGraphic*> m_externalGraphics; //!< An ExternalGraphic gives a reference to a raster or vector graphical object, either online or inline, in an externally-defined graphic format. (Optional)
194  std::vector<Mark*> m_marks; //!< A Mark specifies a geometric shape and applies coloring to it. (Optional)
195  ParameterValue* m_opacity; //!< The Opacity element gives the opacity to use for rendering the graphic. (Optional)
196  ParameterValue* m_size; //!< The Size element gives the absolute size of the graphic in uoms encoded as a floating-point number. (Optional)
197  ParameterValue* m_rotation; //!< The Rotation element gives the rotation of a graphic in the clockwise direction about its center point in decimal degrees, encoded as a floating-point number. Negative values mean counter-clockwise rotation. (Optional)
198  AnchorPoint* m_anchorPoint; //!< The AnchorPoint element of a PointSymbolizer gives the location inside of a Graphic to use for anchoring the graphic to the main-geometry point. (Optional)
199  Displacement* m_displacement; //!< The Displacement gives the X and Y displacements from the "hot-spot" point. (Optional)
200  };
201 
202  } // end namespace se
203 } // end namespace te
204 
205 #endif // __TERRALIB_SE_INTERNAL_GRAPHIC_H
Displacement * m_displacement
The Displacement gives the X and Y displacements from the "hot-spot" point. (Optional) ...
Definition: Graphic.h:199
std::vector< ExternalGraphic * > m_externalGraphics
An ExternalGraphic gives a reference to a raster or vector graphical object, either online or inline...
Definition: Graphic.h:193
A Mark specifies a geometric shape and applies coloring to it.
Definition: Mark.h:84
ParameterValue * m_size
The Size element gives the absolute size of the graphic in uoms encoded as a floating-point number...
Definition: Graphic.h:196
A Displacement gives X and Y offset displacements to use for rendering a text label, graphic or other Symbolizer near a point.
Definition: Displacement.h:58
A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
Definition: Graphic.h:66
The "ParameterValueType" uses WFS-Filter expressions to give values for SE graphic parameters...
An AnchorPoint identifies the location inside of a text label to use an 'anchor' for positioning it r...
Definition: AnchorPoint.h:63
AnchorPoint * m_anchorPoint
The AnchorPoint element of a PointSymbolizer gives the location inside of a Graphic to use for anchor...
Definition: Graphic.h:198
ParameterValue * m_rotation
The Rotation element gives the rotation of a graphic in the clockwise direction about its center poin...
Definition: Graphic.h:197
The ExternalGraphic allows a reference to be made to an external graphic file with a Web URL or to in...
URI C++ Library.
ParameterValue * m_opacity
The Opacity element gives the opacity to use for rendering the graphic. (Optional) ...
Definition: Graphic.h:195
#define TESEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:187
Configuration flags for the Symbology Encoding support of TerraLib.
std::vector< Mark * > m_marks
A Mark specifies a geometric shape and applies coloring to it. (Optional)
Definition: Graphic.h:194