Loading...
Searching...
No Matches
Utils.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/terralib4/Utils.h
22
23 \brief Utilitary functions for dealing with TerraLib 5 and 4.x conversion.
24*/
25
26#ifndef __TERRALIB_T4_INTERNAL_UTILS_H
27#define __TERRALIB_T4_INTERNAL_UTILS_H
28
29// STL
30#include <map>
31#include <memory>
32#include <string>
33
34// Terralib 5
35#include "../common/Enums.h"
36#include "../datatype/Enums.h"
37#include "../datatype/Property.h"
38#include "../geometry/Enums.h"
39#include "Config.h"
40
41// TerraLib 4.x
42#include <terralib4/kernel/TeAttribute.h>
43#include <terralib4/kernel/TeDatabase.h>
44
45namespace te
46{
47 namespace da { class DataSetType; }
48 namespace dt { class Property; }
49 namespace gm { class Envelope; }
50 namespace rst { class RasterProperty; }
51}
52
53struct TeBox;
54class TeDatabaseFactoryParams;
55class TeRasterParams;
56class TeTable;
57
58namespace terralib4
59{
60 /*!
61 \brief It creates a valid TerraLib 5 property given a valid TerraLib 4.x attribute representation.
62
63 \param attRep A TerraLib 3 data type.
64
65 \return The TerraLib 5 equivalent property.
66
67 \exception Exception It throws an exception if a type cannot be conveted to TerraLib 5 datatype system.
68
69 \note The returned PropertyType will not have an identification number, it is the caller
70 responsability to set one.
71 */
72 std::unique_ptr<te::dt::Property> Convert2T5(const TeAttributeRep& attRep);
73
75
76 /*!
77 \brief It converts a Terralib 4.x data type to Terralib 5 data type.
78
79 \param type The type to convert.
80
81 \return A TerraLib 5 data type.
82 */
83 TETERRALIB4EXPORT int Convert2T5(TeAttrDataType type);
84
85 /*!
86 \brief It converts a Terralib 4.x data type to Terralib 5 data type.
87
88 \param type The type to convert.
89
90 \return A TerraLib 5 data type.
91 */
93
94 /*!
95 \brief It converts a Terralib 5 data type to Terralib 4.x data type.
96
97 \param type The type to convert.
98
99 \return A TerraLib 4.x data type.
100 */
101 TeAttrDataType Convert2T4(int type);
102
104
105 int Convert2T5(TeDataType dt);
106
107 std::unique_ptr<te::gm::Envelope> Convert2T5(TeBox box);
108
109 std::unique_ptr<te::da::DataSetType> Convert2T5(TeTable table);
110
111 /*!
112 \brief It converts a data source information to a TerraLib 4.x database params.
113
114 \param dsInfo The data source information to be converted to a TerraLib 4.x database params.
115
116 \return A TerraLib 4.x database params.
117 */
118 std::unique_ptr<TeDatabaseFactoryParams> Convert2T4DatabaseParams(const std::string& dsInfo);
119
120 te::rst::RasterProperty* Convert2T5(TeRasterParams& rparams);
121
122 void CheckDecimalSeparator(std::string& value);
123
124 te::gm::GeomType GetMinimalRepresentation(const std::vector<TeGeometry*>& geoms);
125
127
128 TETERRALIB4EXPORT std::string Convert2Utf8(const std::string& str);
129
130 TETERRALIB4EXPORT std::string Convert2Latin1(const std::string& str);
131
132} // end namespace terralib4
133
134#endif // __TERRALIB_T4_INTERNAL_UTILS_H
135
Raster property.
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:42
TerraLib.
Definition: Band.h:35
te::gm::GeomType Convert2T5GeomType(TeAttrDataType type)
te::gm::GeomType GetCollection(TeGeomRep rep)
void CheckDecimalSeparator(std::string &value)
te::gm::GeomType GetMinimalRepresentation(const std::vector< TeGeometry * > &geoms)
std::unique_ptr< TeDatabaseFactoryParams > Convert2T4DatabaseParams(const std::string &dsInfo)
It converts a data source information to a TerraLib 4.x database params.
TETERRALIB4EXPORT std::string Convert2Latin1(const std::string &str)
std::unique_ptr< te::dt::Property > Convert2T5(const TeAttributeRep &attRep)
It creates a valid TerraLib 5 property given a valid TerraLib 4.x attribute representation.
TeAttrDataType Convert2T4GeomType(te::gm::GeomType type)
TETERRALIB4EXPORT std::string Convert2Utf8(const std::string &str)
TeAttrDataType Convert2T4(int type)
It converts a Terralib 5 data type to Terralib 4.x data type.
#define TETERRALIB4EXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:123
Proxy configuration file for TerraView (see terraview_config.h).