Loading...
Searching...
No Matches
CreateIsolinesCore.h
Go to the documentation of this file.
1/* Copyright (C) 2001-2009 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/mnt/core/CreateIsolines.h
22
23 \brief This file contains a class that represents the create isolines.
24
25 \reference Adapted from TerraLib4.
26*/
27
28#ifndef __TERRALIB_MNT_INTERNAL_CREATEISOLINES_H
29#define __TERRALIB_MNT_INTERNAL_CREATEISOLINES_H
30
31// Terralib Includes
32#include "Config.h"
34
35#include "../../../../src/terralib/dataaccess.h"
36#include "../../../../src/terralib/dataaccess/datasource/DataSourceFactory.h"
37#include "../../../../src/terralib/memory/DataSet.h"
38#include "../../../../src/terralib/common/Holder.h"
39#include "../../../../src/terralib/statistics/core/Enums.h"
40
41// STL Includes
42#include <map>
43#include <memory>
44
45
46namespace te
47{
48 //forward declarations
49 namespace da { class DataSetType; }
50 namespace gm { class Geometry; }
51 namespace mem { class DataSet; }
52}
53
55{
61 m_numRows(0),
62 m_initalRow(0),
63 m_finalRow(0) {}
64};
65
67{
68 public:
69
70 /*! \brief Default constructor. */
72
73 /*! \brief Virtual destructor. */
75
76 public:
77
78 double m_quota;
79 int m_srid;
80 std::vector< te::gm::LineString* > m_vecSegments;
81 std::vector< te::gm::LineString* > m_lsOut;
82};
83
85{
86 public:
87
88 /*! \brief Default constructor. */
90
91 /*! \brief Virtual destructor. */
93
94 public:
95
96 std::unique_ptr<te::rst::Raster> m_rasterPtr;
97 std::vector< std::vector< te::gm::LineString* > > m_vecSegments;
98 std::vector<double> m_nvals;
99};
100
101namespace te
102{
103 namespace mnt
104 {
106 {
107 /*!
108 \class CreateIsolines
109
110 \brief Class used to execute the create isolines
111
112 */
113
114 public:
115
116 /*! \brief Default constructor. */
118
119 /*! \brief Virtual destructor. */
121
122 public:
123
124 void setInput(te::da::DataSourcePtr inRasterDsrc,
125 std::string inRasterName,
126 std::unique_ptr<te::da::DataSetType> inDsetType);
127
128 std::unique_ptr<te::rst::Raster> getPrepareRaster();
129
130 void setParams(std::vector<double> &nval, std::vector<double> &gval, double vmax, double vmin, double dummy, bool hasDummy);
131
132 void setOutput(te::da::DataSourcePtr outDsrc, std::string dsname);
133
134 bool run(std::unique_ptr<te::rst::Raster> raster);
135
136 static bool generateSegments(std::unique_ptr<te::rst::Raster> raster, std::vector<double> nvals, std::vector< std::vector< te::gm::LineString* > >& vecSegments);
137
138 static bool connectLines(std::vector< te::gm::LineString* > vec, int srid, std::vector< te::gm::LineString* >& lsOut);
139
140 static void interpolacao(int direction, te::gm::LineString* line, double quota, double coord, double c_inf, double c_sup, double z_inf, double z_sup);
141
143
144 static void firstCaseSpecial(double quota, double& lineSupLeft, double& lineSupRigth, double& lineInfLeft, double& lineInfRigth);
145
146 static void segments(int idQuota, std::unique_ptr<te::gm::LineString> line, double quota, double ylg_sup, double xlg_ant, double xlg_pos, double ylg_inf,
147 double& lineSupLeft, double& lineSupRigth, double& lineInfLeft, double& lineInfRigth, std::vector< std::vector<te::gm::LineString*> >& vecSegments);
148
150
151 std::vector<RasterBlockSize> calculateBlocks(unsigned int numRows, unsigned int numThreads);
152
153 void rstMemoryBlock(std::unique_ptr<te::rst::Raster> raster, std::vector<RasterBlockSize> vecBlocks, std::vector<GenerateSegmentsParams*>& vecGenerateParams);
154
155 bool connectLines1(std::vector<te::gm::LineString*> vecSegments, double scale, std::vector<te::gm::LineString*>& lsOut);
156 bool connectLines(std::vector<te::gm::LineString*> vecSegments, std::vector<te::gm::LineString*>& lsOut);
157
158 protected:
159
161 std::string m_inRasterName;
162 std::unique_ptr<te::da::DataSetType> m_inRasterDsType;
163
165 std::string m_outDsetName;
166
167 std::vector<double> m_values;
168 std::vector<double> m_guidevalues;
170
171 static double m_vmax;
172 static double m_vmin;
173 static double m_dummy;
174 static bool m_hasDummy;
175 };
176 }
177}
178
179#endif //__TERRALIB_MNT_INTERNAL_CREATEISOLINES_H
std::vector< te::gm::LineString * > m_vecSegments
std::vector< te::gm::LineString * > m_lsOut
ConnectLinesParams()
Default constructor.
~ConnectLinesParams()
Virtual destructor.
std::unique_ptr< te::rst::Raster > m_rasterPtr
~GenerateSegmentsParams()
Virtual destructor.
std::vector< double > m_nvals
GenerateSegmentsParams()
Default constructor.
std::vector< std::vector< te::gm::LineString * > > m_vecSegments
LineString is a curve with linear interpolation between points.
Definition: LineString.h:65
te::da::DataSourcePtr m_outDsrc
static bool generateSegmentsThreaded(GenerateSegmentsParams *params)
te::da::DataSourcePtr m_inRasterDsrc
static bool connectLines(std::vector< te::gm::LineString * > vec, int srid, std::vector< te::gm::LineString * > &lsOut)
static void firstCaseSpecial(double quota, double &lineSupLeft, double &lineSupRigth, double &lineInfLeft, double &lineInfRigth)
std::unique_ptr< te::da::DataSetType > m_inRasterDsType
void rstMemoryBlock(std::unique_ptr< te::rst::Raster > raster, std::vector< RasterBlockSize > vecBlocks, std::vector< GenerateSegmentsParams * > &vecGenerateParams)
void setInput(te::da::DataSourcePtr inRasterDsrc, std::string inRasterName, std::unique_ptr< te::da::DataSetType > inDsetType)
bool connectLines1(std::vector< te::gm::LineString * > vecSegments, double scale, std::vector< te::gm::LineString * > &lsOut)
std::vector< double > m_guidevalues
void setOutput(te::da::DataSourcePtr outDsrc, std::string dsname)
bool run(std::unique_ptr< te::rst::Raster > raster)
static bool connectLinesThreaded(ConnectLinesParams *params)
void setParams(std::vector< double > &nval, std::vector< double > &gval, double vmax, double vmin, double dummy, bool hasDummy)
std::unique_ptr< te::rst::Raster > getPrepareRaster()
std::vector< RasterBlockSize > calculateBlocks(unsigned int numRows, unsigned int numThreads)
static void segments(int idQuota, std::unique_ptr< te::gm::LineString > line, double quota, double ylg_sup, double xlg_ant, double xlg_pos, double ylg_inf, double &lineSupLeft, double &lineSupRigth, double &lineInfLeft, double &lineInfRigth, std::vector< std::vector< te::gm::LineString * > > &vecSegments)
CreateIsolines()
Default constructor.
bool connectLines(std::vector< te::gm::LineString * > vecSegments, std::vector< te::gm::LineString * > &lsOut)
~CreateIsolines()
Virtual destructor.
static bool generateSegments(std::unique_ptr< te::rst::Raster > raster, std::vector< double > nvals, std::vector< std::vector< te::gm::LineString * > > &vecSegments)
static void interpolacao(int direction, te::gm::LineString *line, double quota, double coord, double c_inf, double c_sup, double z_inf, double z_sup)
std::vector< double > m_values
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1449
TerraLib.
#define TEMNTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:41
Proxy configuration file for TerraView (see terraview_config.h).