VR-Forces 4.1 Class Documentation
geosGeometry.h
Go to the documentation of this file.
1 
2 
3 
4 
5 #pragma once
6 
8 
9 #include <geos.h>
10 
11 #include <tbb/recursive_mutex.h>
12 
13 namespace MAKVRinTerra
14 {
15 
17 class DT_DLL_features DtGeosGeometry : public DtFeatureGeometry::Implementation
18 {
19 public:
20  typedef boost::shared_ptr<DtGeosGeometry> Ptr;
21  typedef boost::shared_ptr<const DtGeosGeometry> CPtr;
22 
23  typedef DtFeatureGeometry::Implementation Implementation;
25 
26  typedef tbb::recursive_mutex Mutex;
27 
28  template <Type T>
29  struct GeosType
30  {
31  typedef geos::geom::Geometry type;
32  };
33 
34  typedef std::vector<geos::geom::Coordinate> CoordinateVector;
35 
36  static DtFeatureGeometry MakePoint(const geos::geom::Coordinate&, const DtProj&);
37  static DtFeatureGeometry MakeLineString(std::auto_ptr<CoordinateVector>, const DtProj&);
38  static DtFeatureGeometry MakeLinearRing(std::auto_ptr<CoordinateVector>, const DtProj&);
39  static DtFeatureGeometry MakePolygon(
40  std::auto_ptr<CoordinateVector>, std::auto_ptr< std::vector<CoordinateVector> >,
41  const DtProj&);
42  static DtFeatureGeometry MakeMultiPoint(std::auto_ptr<CoordinateVector>, const DtProj&);
43 
44  static DtFeatureGeometry Convert(DtFeatureGeometry);
45 
46  static DtFeatureGeometry Make(geos::geom::Geometry*, const DtProj&);
47 
48  static DtFeatureGeometry::Area MakeBox(
49  DtFeatureGeometry::Point, double length, double width, double rotation);
50  static DtFeatureGeometry::Area MakeBox(
51  const DtProj&, double xmin, double ymin, double xmax, double ymax);
52 
53  static DtFeatureGeometry::Area MakeArea(
54  const DtProj&, std::vector<DtPoint> points);
55  static DtFeatureGeometry::Area MakeArea(
56  const DtProj&, std::vector<DtVector> points);
57 
58  static DtFeatureGeometry::Point MakePoint(const DtPoint &, const DtProj &);
59 
60  static DtFeatureGeometry::Path MakePath(std::auto_ptr<CoordinateVector>, const DtProj &);
61 
62  unsigned numberOfPoints() const;
63 
64  DtPoint centroid() const;
65 
66  bool intersects(DtFeatureGeometry) const;
67 
68  bool overlaps(DtFeatureGeometry) const;
69 
70  bool covers(DtFeatureGeometry) const;
71 
72  bool within(DtFeatureGeometry) const;
73 
74  double distanceTo(DtFeatureGeometry, const DtProj&) const;
75 
76  DtFeatureGeometry unionWith(DtFeatureGeometry) const;
77 
78  DtFeatureGeometry intersectionWith(DtFeatureGeometry) const;
79 
80  DtFeatureGeometry::Point closestPointTo(DtFeatureGeometry, double* distanceTo = NULL) const;
81 
82 
103 
104  virtual const geos::geom::Geometry& geosGeometry() const = 0;
105 };
106 
107 template <>
109 {
110  typedef geos::geom::Point type;
111 };
112 
113 template <>
115 {
116  typedef geos::geom::LineString type;
117 };
118 
119 template <>
121 {
122  typedef geos::geom::Polygon type;
123 };
124 
125 template <>
127 {
128  typedef geos::geom::GeometryCollection type;
129 };
130 
131 template <DtFeatureGeometry::Type T>
133 {
134 public:
135  typedef boost::shared_ptr<DtGeosGeometryImpl> Ptr;
136 
137  static DtFeatureGeometry Convert(DtFeatureGeometry::Handle<T>);
138 
139  Type type() const;
140 
141  std::auto_ptr<PointVector> points() const;
142  unsigned numberOfSubGeometries() const;
143  std::auto_ptr<GeometryVector> subGeometries() const;
144 
145 //protected:
146  const typename GeosType<T>::type& geosGeometry() const = 0;
147 
148  virtual boost::shared_ptr<const typename GeosType<T>::type> geosPtr() const = 0;
149 };
150 
155 
156 }

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)