Loading...
Searching...
No Matches
SnapVertex.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/edit/SnapVertex.h
22
23 \brief This class implements a vertex search snap.
24*/
25
26#ifndef __TERRALIB_EDIT_INTERNAL_SNAPVERTEX_H
27#define __TERRALIB_EDIT_INTERNAL_SNAPVERTEX_H
28
29// TerraLib
30#include "../sam/rtree/Index.h"
31#include "Snap.h"
32
33// STL
34#include <vector>
35
36namespace te
37{
38 namespace edit
39 {
40 /*!
41 \class SnapVertex
42
43 \brief This class implements a vertex search snap.
44 */
46 {
47 public:
48
49 SnapVertex(const std::string& source, int srid = TE_UNKNOWN_SRS);
50
52
53 void add(te::gm::Geometry* geom);
54
55 void clear();
56
57 std::string getName() const;
58
59 std::string getDescription() const;
60
61 static Snap* Builder(const std::string& source, int srid);
62
63 protected:
64
65 bool search(const te::gm::Envelope& e, te::gm::Coord2D& result);
66
67 private:
68
69 std::vector<te::gm::Coord2D> m_coords; //!< The snap coordinates.
70 te::sam::rtree::Index<std::size_t, 8> m_rtree; //!< Internal index used to retrieve geometries spatially.
71 };
72
73 } // end namespace edit
74} // end namespace te
75
76#endif // __TERRALIB_EDIT_INTERNAL_SNAPVERTEX_H
This class implements geometry snap concept.
This class implements a vertex search snap.
Definition: SnapVertex.h:46
SnapVertex(const std::string &source, int srid=TE_UNKNOWN_SRS)
void add(te::gm::Geometry *geom)
std::vector< te::gm::Coord2D > m_coords
The snap coordinates.
Definition: SnapVertex.h:69
std::string getName() const
static Snap * Builder(const std::string &source, int srid)
bool search(const te::gm::Envelope &e, te::gm::Coord2D &result)
te::sam::rtree::Index< std::size_t, 8 > m_rtree
Internal index used to retrieve geometries spatially.
Definition: SnapVertex.h:70
std::string getDescription() const
This class implements geometry snap concept.
Definition: Snap.h:64
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
A class that represents an R-tree.
Definition: Index.h:57
TerraLib.
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:41
#define TEEDITEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:68
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
Definition: Config.h:43