ExternalGraphic.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/ExternalGraphic.h
22 
23  \brief The ExternalGraphic allows a reference to be made to an external graphic file with a Web URL or to in-line content.
24 */
25 
26 #ifndef __TERRALIB_SE_INTERNAL_EXTERNALGRAPHIC_H
27 #define __TERRALIB_SE_INTERNAL_EXTERNALGRAPHIC_H
28 
29 // TerraLib
30 #include "Config.h"
31 
32 // STL
33 #include <string>
34 #include <vector>
35 
36 // Boost
37 #include <boost/noncopyable.hpp>
38 
39 namespace te
40 {
41 // Forward declarations
42  namespace xl { class SimpleLink; }
43  namespace se
44  {
45 // Forward declarations
46  class InlineContent;
47  class Recode;
48 
49  /*!
50  \class ExternalGraphic
51 
52  \brief The ExternalGraphic allows a reference to be made to an external graphic file with a Web URL or to in-line content.
53 
54  The OnlineResource sub-element gives the
55  URL and the Format sub-element identifies
56  the expected document MIME type of a successful
57  fetch. Knowing the MIME type in advance allows
58  the styler to select the best-supported format
59  from the list of URLs with equivalent content.
60  Users should avoid referencing external graphics
61  that may change at arbitrary times, since many systems
62  may cache or permanently store graphic content for
63  improved efficiency and reliability. Graphic content
64  should be static when at all possible.
65  <br>
66  The InlineContent sub-element allows the content of an
67  external graphic object to be included in-line. The two
68  choices for encoding are XML and Base-64-encoded binary,
69  as indicated by the encoding attribute. An issue with the
70  XML encoding is that the <?xml ...?> tag of the object
71  cannot be present inside of the InlineContent tag. The
72  external graphic object will be extracted and used like
73  the content fetched from an ExternalContent tag.
74  <br>
75  The ColorReplacement element, which may occur multiple
76  times, allows to replace a color in the ExternalGraphic,
77  the color specified in the OriginalColor sub-element,
78  by another color as a result of a recode function.
79  LookUpValue is in this case set to ExternalGraphic,
80  both Data and Value elements are set to color values.
81 
82  \ingroup se
83 
84  \sa Graphic, InlineContent, Recode
85  */
86  class TESEEXPORT ExternalGraphic : public boost::noncopyable
87  {
88  public:
89 
90  /** @name Initializer Methods
91  * Methods related to instantiation and destruction.
92  */
93  //@{
94 
95  /*! \brief It initializes a new ExternalGraphic. */
97 
98  /*! \brief Destructor. */
99  ~ExternalGraphic();
100 
101  //@}
102 
103  /** @name Accessor methods
104  * Methods used to get or set properties.
105  */
106  //@{
107 
108  void setOnlineResource(te::xl::SimpleLink* onlineResource);
109 
110  const te::xl::SimpleLink* getOnlineResource() const;
111 
112  void setInlineContent(InlineContent* inlineContent);
113 
114  const InlineContent* getInlineContent() const;
115 
116  void setFormat(const std::string& f);
117 
118  const std::string& getFormat() const;
119 
120  void add(Recode* r);
121 
122  //@}
123 
124  /*! \brief It creates a new copy of this object. */
125  ExternalGraphic* clone() const;
126 
127  private:
128 
129  te::xl::SimpleLink* m_onlineResource; //!< The URL of the external graphic. (Mandatory if m_inlineContent is absent)
130  InlineContent* m_inlineContent; //!< It allows the content of an external graphic object to be included in-line. (Mandatory if m_onlineResource is absent)
131  std::string m_format; //!< It identifies the expected document MIME type of a successful fetch. (Mandatory)
132  std::vector<Recode*> m_colorReplacements; //!< Transformation of discrete values to other values. (Optional)
133  };
134 
135  } // end namespace se
136 } // end namespace te
137 
138 #endif // __TERRALIB_SE_INTERNAL_EXTERNALGRAPHIC_H
139 
InlineContent * m_inlineContent
It allows the content of an external graphic object to be included in-line. (Mandatory if m_onlineRes...
te::xl::SimpleLink * m_onlineResource
The URL of the external graphic. (Mandatory if m_inlineContent is absent)
std::vector< Recode * > m_colorReplacements
Transformation of discrete values to other values. (Optional)
InlineContent is XML- or base64-encoded encoded content in some externally-defined format that is inc...
Definition: InlineContent.h:51
The ExternalGraphic allows a reference to be made to an external graphic file with a Web URL or to in...
std::string m_format
It identifies the expected document MIME type of a successful fetch. (Mandatory)
URI C++ Library.
#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.
Transformation of discrete values to other values.
Definition: Recode.h:75