BoundaryExtract.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/raster/BoundaryExtract.h
22 
23  \brief It implements the raster boundary extractor
24 */
25 
26 #ifndef __TERRALIB_RASTER_INTERNAL_BOUNDARYEXTRACT_H
27 #define __TERRALIB_RASTER_INTERNAL_BOUNDARYEXTRACT_H
28 
29 
30 
31 // TerraLib
32 #include "../geometry/Coord2D.h"
33 #include "../geometry/LineString.h"
34 #include "../sam/rtree.h"
35 #include "Enums.h"
36 #include "Raster.h"
37 #include "Vectorizer.h"
39 
40 // STL
41 #include <vector>
42 
43 namespace te
44 {
45  namespace rst
46  {
47 // Forward declaration.
48  class Raster;
49 
50  /*!
51  \class BoundaryExtract
52 
53  \brief It implements the Boundary Extract (vectorizer specialization - extract only one pixel value)
54 
55  This algorithm implements a vectorizer, which is an algorithm to convert an
56  image with pixel-labels into a set of polygons. All connected pixels in the
57  image with the same label will define an individual polygon. This algorithm
58  is based on the implementation of the previous version of this library, the
59  TerraLib 4.
60 
61  \ingroup rst
62 
63  \sa Raster, Geometry
64  */
66  {
67  public:
68 
69  /*!
70  \brief Constructor.
71 
72  \param r The input raster.
73  \param b The selected band of the raster to be vectorized.
74  \param mp The maximum allowed number of polygons to be created (default = 0, unlimited).
75  \param noDataExclusion If true, regions with no-data pixels will not generate geometries.
76  */
77  BoundaryExtract(Raster* r, std::size_t b, unsigned int mp = 0, const bool noDataExclusion = true );
78 
79  /*! \brief Destructor. */
80  ~BoundaryExtract();
81 
82 
83  /*!
84  \brief Returns true if current algorithm implementation runs ok, false otherwise.
85 
86  \param polygons The vector of polygons (will be cleared) to get the result of the vectorization.
87 
88  \param polygonsValues A pointer to a valid vector where the raster pixel values related to each polygon will be stored, or a NULL pointer.
89 
90  \note The caller of this method must take the ownership of the returned geometries and must delete them when necessary.
91  */
92  bool run(std::vector<te::gm::Geometry*>& polygons, double pixelvalue );
93 
94  protected:
95 
96  /*!
97  \brief Detects an edge of a cell in Raster.
98 
99  \param segmentInitialCol abscissa (column) of the upper-left point of the shape
100  \param segmentInitialRow ordinate (line) of the upper-left point of the shape
101  \param line 2D Line.
102 
103  \return true if ok, otherwise false
104  */
105  bool detectEdge(long segmentInitialCol, long segmentInitialRow, te::gm::LinearRing& outputLine);
106 
107  };
108  } // end namespace rst
109 } // end namespace te
110 
111 #endif // __TERRALIB_RASTER_INTERNAL_BOUNDARYEXTRACT_H
#define TERASTEREXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
It implements the vectorizer, based on TerraLib 4 algorithm.
A LinearRing is a LineString that is both closed and simple.
Definition: LinearRing.h:53
Enumerations for the Raster module.
An abstract class for raster data strucutures.
An abstract class for raster data strucutures.
Definition: Raster.h:71
TerraLib.
It implements the vectorizer, based on TerraLib 4 algorithm.
Definition: Vectorizer.h:64
A polygon container node class.
It implements the Boundary Extract (vectorizer specialization - extract only one pixel value) ...