Loading...
Searching...
No Matches
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
37namespace 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 */
113
114 /*!
115 * \brief Gets the first geometry associated to this feature. The caller will NOT take the ownership of the object
116 *
117 * \return The first geometry associated to this feature
118 */
120
121 /*!
122 * \brief Sets the first geometry value associated to this feature. This will take the ownership of the object
123 *
124 * \param The geometry to be associated to this feature
125 */
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(int srid);
134
135 /*!
136 * \brief It converts the coordinate values of the feature to the new spatial reference system.
137 *
138 * \param The new Spatial Reference System ID used to transform the coordinates of the feature.
139 */
141
142 //!< Sets the srid of the feature. The given value will be applied to all geometries
143 void setSRID(int srid);
144
145 /*!
146 \brief Creates a Feature based on the current row of the givem DataSet
147 */
149
150 protected:
151
152 std::size_t getFirstGeometryPropertyPos() const;
153
154 protected:
155
157 };
158 }
159}
160
161#endif //__TERRALIB_VP_INTERNAL_FEATURE_H
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver.
Definition: DataSetItem.h:59
A class that models the description of a dataset.
Definition: DataSetType.h:73
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:114
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver.
Definition: DataSetItem.h:55
A Converter is responsible for the conversion of coordinates between different Coordinate Systems (CS...
Definition: Converter.h:54
An alias for a set of Features.
Definition: Feature.h:60
A feature is a composition of a geometry and its attributes.
Definition: Feature.h:70
Feature(const te::da::DataSetItem &dataSetItem)
Constructor.
void setFirstGeometry(te::gm::Geometry *geometry)
Sets the first geometry value associated to this feature. This will take the ownership of the object.
Feature(const Feature &rhs)
It creates a new feature by cloning the values in the source feature (rhs).
const te::gm::Geometry * getFirstGeometryPtr() const
Gets the first geometry associated to this feature. The caller will NOT take the ownership of the obj...
void transform(te::srs::Converter *converter)
It converts the coordinate values of the feature to the new spatial reference system.
static te::vp::Feature * createFeatureFromCurrent(const te::da::DataSet *dataSet)
Creates a Feature based on the current row of the givem DataSet.
void setSRID(int srid)
virtual ~Feature()
Destructor.
std::size_t getFirstGeometryPropertyPos() const
Feature(const te::da::DataSetType *dataSetType)
virtual te::da::DataSetItem * clone() const override
Clones the feature.
std::size_t m_firstGeometryPropertyPos
Definition: Feature.h:156
std::unique_ptr< te::gm::Geometry > getFirstGeometry() const
Gets the first geometry associated to this feature. The caller will take the ownership of the object.
Feature(const te::da::DataSet *dataSet)
te::gm::Geometry * getFirstGeometryPtr()
Gets the first geometry associated to this feature. The caller will NOT take the ownership of the obj...
void transform(int srid)
It converts the coordinate values of the feature to the new spatial reference system.
TerraLib.
#define TEVPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
Proxy configuration file for TerraView (see terraview_config.h).