Feature.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/geometry/Feature.h
22 
23  \brief A feature is a composition of a geometry and its attributes
24  */
25 
26 #ifndef __TERRALIB_VP_INTERNAL_FEATURE_H
27 #define __TERRALIB_VP_INTERNAL_FEATURE_H
28 
29  // TerraLib
30 #include "Config.h"
31 
32 #include "../memory/DataSetItem.h"
33 
34 #include <memory>
35 #include <vector>
36 
37 namespace te
38 {
39  namespace da
40  {
41  class DataSetItem;
42  class DataSetType;
43  }
44 
45  namespace gm
46  {
47  class Geometry;
48  }
49 
50  namespace srs
51  {
52  class Converter;
53  }
54 
55  namespace vp
56  {
57  class Feature;
58 
59  //!< An alias for a set of Features
60  class TEVPEXPORT FeatureSet : public std::vector<Feature*> {};
61 
62  /*!
63  \class Feature
64 
65  \brief A feature is a composition of a geometry and its attributes
66 
67  \ingroup geometry
68  */
70  {
71  public:
72 
73  explicit Feature(const te::da::DataSet* dataSet);
74 
75  explicit Feature(const te::da::DataSetType* dataSetType);
76 
77  /*!
78  * \brief Constructor
79  \param dataSetItem The dataset item to be associated with this feature. Feature will take the ownership of the given dataset item
80  */
81  explicit Feature(const te::da::DataSetItem& dataSetItem);
82 
83  /*!
84  \brief It creates a new feature by cloning the values in the source feature (rhs).
85 
86  \param rhs The right-hand-side object to copy its values.
87  */
88  explicit Feature(const Feature& rhs);
89 
90  /*!
91  * \brief Destructor
92  */
93  virtual ~Feature();
94 
95  /*!
96  * \brief Clones the feature
97  */
98  virtual te::da::DataSetItem* clone() const override;
99 
100  /*!
101  * \brief Gets the first geometry associated to this feature. The caller will take the ownership of the object
102  *
103  * \return The first geometry associated to this feature
104  */
105  std::unique_ptr<te::gm::Geometry> getFirstGeometry() const;
106 
107  /*!
108  * \brief Gets the first geometry associated to this feature. The caller will NOT take the ownership of the object
109  *
110  * \return The first geometry associated to this feature
111  */
112  const te::gm::Geometry* getFirstGeometryPtr() const;
113 
114  /*!
115  * \brief Sets the first geometry value associated to this feature. This will take the ownership of the object
116  *
117  * \param The geometry to be associated to this feature
118  */
119  void setFirstGeometry(te::gm::Geometry* geometry);
120 
121  /*!
122  * \brief It converts the coordinate values of the feature to the new spatial reference system.
123  *
124  * \param The new Spatial Reference System ID used to transform the coordinates of the feature.
125  */
126  void transform(int srid);
127 
128  /*!
129  * \brief It converts the coordinate values of the feature to the new spatial reference system.
130  *
131  * \param The new Spatial Reference System ID used to transform the coordinates of the feature.
132  */
133  void transform(te::srs::Converter* converter);
134 
135  //!< Sets the srid of the feature. The given value will be applied to all geometries
136  void setSRID(int srid);
137 
138  /*!
139  \brief Creates a Feature based on the current row of the givem DataSet
140  */
141  static te::vp::Feature* createFeatureFromCurrent(const te::da::DataSet* dataSet);
142 
143  protected:
144 
145  std::size_t getFirstGeometryPropertyPos() const;
146 
147  protected:
148 
150  };
151  }
152 }
153 
154 #endif //__TERRALIB_VP_INTERNAL_FEATURE_H
#define TEVPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
A class that models the description of a dataset.
Definition: DataSetType.h:72
std::size_t m_firstGeometryPropertyPos
Definition: Feature.h:149
An alias for a set of Features.
Definition: Feature.h:60
TerraLib.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:77
A Converter is responsible for the conversion of coordinates between different Coordinate Systems (CS...
Definition: Converter.h:53
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
Definition: DataSetItem.h:54
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:113
Configuration flags for the Terrralib Vector Processing module.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
Definition: DataSetItem.h:58
A feature is a composition of a geometry and its attributes.
Definition: Feature.h:69