All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MD_DataIdentification.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/metadata/iso19115/MD_DataIdentification.cpp
22  */
23 
24 // TerraLib
25 #include "MD_DataIdentification.h"
26 
27 // Boost
28 #include <boost/foreach.hpp>
29 
30 
31 te::md::MD_DataIdentification::MD_DataIdentification(te::md::CI_Citation* cite, const std::string& abstract,MD_ProgressCode status, const std::string& lang):
32  MD_Identification(cite,abstract, status),
33  m_dataIsCovered(true),
34  m_spatialRepresentationType(te::md::MD_vector),
35  m_scale(0)
36 {
37  m_language.push_back(lang);
38 }
39 
41 {
42 }
43 
44 void
46 {
47  m_language.push_back(lang);
48 }
49 
50 const std::vector<std::string>&
52 {
53  return m_language;
54 }
55 
56 void
58 {
59  m_charSet.push_back(code);
60 }
61 
62 const std::vector<te::md::MD_CharacterSetCode>&
64 {
65  return m_charSet;
66 }
67 
68 void
70 {
71  m_topicCategory.push_back(code);
72 }
73 
74 const std::vector<te::md::MD_TopicCategoryCode>&
76 {
77  return m_topicCategory;
78 }
79 
80 void
81 te::md::MD_DataIdentification::addGeographicBBoxExt(const double& llx, const double& lly,
82  const double& urx, const double& ury,
83  bool dataIsCovered)
84 {
85  m_extent.init(llx, lly, urx, ury);
86  m_dataIsCovered = dataIsCovered;
87 }
88 
89 void
91 {
92  assert(bb);
93  m_extent.init(bb->getLowerLeftX(), bb->getLowerLeftY(), bb->getUpperRightX(), bb->getUpperRightY());
94 }
95 
96 
97 const
99 {
100  return m_extent;
101 }
102 
103 
104 void
106 {
107  m_spatialRepresentationType = code;
108 }
109 
112 {
113  return m_spatialRepresentationType;
114 }
115 
116 
117 void
119 {
120  assert(d>0);
121 
122  m_scale = d;
123 }
124 
125 long
127 {
128  return m_scale;
129 }
130 
132 {
133  std::string l("");
134  if (!m_language.empty())
135  l = m_language[0];
136 
137  te::md::MD_DataIdentification* mid = new MD_DataIdentification(m_citation, m_abstract, m_status,l);
138 
139  BOOST_FOREACH(const te::md::MD_CharacterSetCode& cs, m_charSet)
140  {
141  mid->addCharacterSet(cs);
142  }
143  BOOST_FOREACH(const te::md::MD_TopicCategoryCode& t, m_topicCategory)
144  {
145  mid->addTopicCategory(t);
146  }
147  mid->addGeographicBBoxExt(m_extent.getLowerLeftX(),m_extent.getLowerLeftY(),
148  m_extent.getUpperRightX(), m_extent.getUpperRightY(),
149  m_dataIsCovered);
150  mid->setSpatialRepType(m_spatialRepresentationType);
151 
152  return mid;
153 }
154 
155 
void addGeographicBBoxExt(const double &llx, const double &lly, const double &urx, const double &ury, bool isInside=true)
Adds the spatial description of the dataset.
const std::vector< MD_CharacterSetCode > & getCharsetCodes() const
Returns a character coding standard in the dataset.
const double & getUpperRightX() const
It returns a constant refernce to the x coordinate of the upper right corner.
Definition: Envelope.h:410
void addLanguage(const std::string &lang)
Adds a language used within the dataset.
const double & getLowerLeftY() const
It returns a constant refernce to the y coordinate of the lower left corner.
Definition: Envelope.h:400
const std::vector< std::string > & getLanguages() const
Returns the set of languages associated to the dataset.
const std::vector< MD_TopicCategoryCode > & getTopicCategories() const
Return the themes associated to the dataset.
long getScale() const
Returns the scale information. If equal to 0 the denominator is not valid.
const double & getUpperRightY() const
It returns a constant refernce to the x coordinate of the upper right corner.
Definition: Envelope.h:420
Provides a standardized method for citing a resource (dataset, feature, source, publication, etc.)
Definition: CI_Citation.h:53
te::md::MD_SpatialRepresentationTypeCode getSpatialRepTypeCode() const
Returns the spatial representation type.
std::vector< std::string > m_language
MD_DataIdentification(CI_Citation *cite, const std::string &abstract, MD_ProgressCode status, const std::string &lang)
Constructor.
MD_SpatialRepresentationTypeCode
Definition: CodeList.h:523
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
Information required to identify a dataset.
const te::gm::Envelope & getExtent() const
Returns the set of extents for the dataset.
MD_ProgressCode
status of the dataset or progress of a review
Definition: CodeList.h:459
void addCharacterSet(MD_CharacterSetCode code)
Adds a character coding standard in the dataset.
MD_Identification * clone() const
Gets a copy of this object.
void setScale(long d)
Sets resource scale. The scale of a map or other cartographic object expressed as a fraction or ratio...
const double & getLowerLeftX() const
It returns a constant reference to the x coordinate of the lower left corner.
Definition: Envelope.h:390
void addTopicCategory(MD_TopicCategoryCode code)
Adds a theme of the dataset.
Information required to identify a dataset.
Identification information contains information to uniquely identify the data.
void setSpatialRepType(te::md::MD_SpatialRepresentationTypeCode code)
Sets the spatial representation type.
MD_CharacterSetCode
name of the character coding standard used in the resource
Definition: CodeList.h:204
MD_TopicCategoryCode
high-level geographic data thematic classification to assist in the grouping and search of available ...
Definition: CodeList.h:540