All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ExternalGraphic.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 terralib/se/ExternalGraphic.cpp
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 // TerraLib
27 #include "../common/STLUtils.h"
28 #include "../xlink/SimpleLink.h"
29 #include "ExternalGraphic.h"
30 #include "InlineContent.h"
31 #include "Recode.h"
32 
34  : m_onlineResource(0),
35  m_inlineContent(0)
36 {
37 }
38 
40 {
41  delete m_onlineResource;
42  delete m_inlineContent;
43 
44  te::common::FreeContents(m_colorReplacements);
45 }
46 
48 {
49  delete m_onlineResource;
50  m_onlineResource = onlineResource;
51 }
52 
54 {
55  return m_onlineResource;
56 }
57 
59 {
60  delete m_inlineContent;
61  m_inlineContent = inlineContent;
62 }
63 
65 {
66  return m_inlineContent;
67 }
68 
69 void te::se::ExternalGraphic::setFormat(const std::string& f)
70 {
71  m_format = f;
72 }
73 
74 const std::string& te::se::ExternalGraphic::getFormat() const
75 {
76  return m_format;
77 }
78 
80 {
81  m_colorReplacements.push_back(r);
82 }
83 
85 {
86  ExternalGraphic* externalGraphic = new ExternalGraphic;
87 
88  externalGraphic->setFormat(m_format);
89 
90  if(m_onlineResource)
91  externalGraphic->setOnlineResource(new te::xl::SimpleLink(*m_onlineResource));
92 
93  if(m_inlineContent)
94  externalGraphic->setInlineContent(m_inlineContent->clone());
95 
96  // TODO: std::vector<Recode*>
97 
98  return externalGraphic;
99 }
void setInlineContent(InlineContent *inlineContent)
InlineContent is XML- or base64-encoded encoded content in some externally-defined format that is inc...
Definition: InlineContent.h:51
const te::xl::SimpleLink * getOnlineResource() const
The ExternalGraphic allows a reference to be made to an external graphic file with a Web URL or to in...
ExternalGraphic * clone() const
It creates a new copy of this object.
InlineContent is XML or base64 encoded content in some externally-defined format that is included in ...
const InlineContent * getInlineContent() const
const std::string & getFormat() const
Transformation of discrete values to other values.
Definition: Recode.h:75
The ExternalGraphic allows a reference to be made to an external graphic file with a Web URL or to in...
void setFormat(const std::string &f)
~ExternalGraphic()
Destructor.
void setOnlineResource(te::xl::SimpleLink *onlineResource)
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
Definition: BoostUtils.h:55
ExternalGraphic()
It initializes a new ExternalGraphic.
Transformation of discrete values to other values.