15 #include <geometry/point.h>
17 #include <boost/function.hpp>
25 class recursive_mutex;
28 namespace MAKVRinTerra
61 template <Type T>
class Handle;
70 typedef Handle<PointType>
Point;
71 typedef Handle<PathType>
Path;
72 typedef Handle<AreaType>
Area;
80 class RelationshipMatrix;
83 typedef boost::shared_ptr<Implementation>
ImplPtr;
86 typedef boost::shared_ptr<const Implementation>
ImplCPtr;
92 typedef tbb::recursive_mutex
Mutex;
95 static std::string ToString(
Type);
99 static Area MakeBox(
Point,
double length,
double width,
double rotation);
100 static Area MakeBox(
const DtProj&,
double xmin,
double ymin,
double xmax,
double ymax);
106 static Area MakeArea(
const DtProj&,
const std::vector<DtPoint>& points);
107 static Area MakeArea(
const DtProj&,
const std::vector<DtVector>& points);
108 static Path MakePath(
const DtProj&,
const std::vector<DtPoint>& points);
109 static Path MakePath(
const DtProj&,
const std::vector<DtVector>& points);
117 template <
typename Container>
123 template <
typename Iterator>
172 std::string description()
const;
175 bool isValid()
const;
178 bool isEmpty()
const;
181 bool isUnknown()
const;
184 bool isPoint()
const;
193 unsigned dimension()
const;
204 template <
typename T>
205 boost::shared_ptr<T> cast();
207 template <
typename T>
208 boost::shared_ptr<const T> cast()
const;
211 const DtProj& projection()
const;
220 void convert(
const DtProj& p);
223 void convertToLocalTopo();
231 unsigned numberOfPoints()
const;
235 std::auto_ptr<PointVector> points()
const;
238 std::auto_ptr<PointVector> pointsWithHeight()
const;
240 boost::optional<DtPoint> singlePointWithHeight()
const;
244 std::auto_ptr<PointVector> pointsWithoutHeight()
const;
247 unsigned numberOfSubGeometries()
const;
250 std::auto_ptr<GeometryVector> subGeometries()
const;
283 double length()
const;
289 Point centroid()
const;
331 class Lock : boost::noncopyable
351 template <
typename T>
357 template <
typename T>
365 :
public boost::enable_shared_from_this<DtFeatureGeometry::Implementation>
378 virtual Mutex& getMutex()
const;
380 virtual std::string description()
const;
382 virtual bool isValid()
const;
384 virtual bool isEmpty()
const;
386 virtual unsigned dimension()
const;
388 virtual Hash hash()
const;
395 virtual bool unique()
const;
398 virtual const DtProj & projection()
const = 0;
405 virtual void convert(
const DtProj &) = 0;
408 virtual void prepare();
413 virtual Type type()
const = 0;
416 virtual unsigned numberOfPoints()
const = 0;
419 virtual std::auto_ptr<PointVector> points()
const = 0;
422 virtual boost::optional<DtPoint> singlePoint()
const;
425 virtual unsigned numberOfSubGeometries()
const = 0;
428 virtual std::auto_ptr<GeometryVector> subGeometries()
const = 0;
455 virtual double length()
const = 0;
457 virtual double area()
const = 0;
460 virtual Point centroid()
const = 0;
501 typedef boost::shared_ptr<EmptyImplementation>
Ptr;
514 std::auto_ptr<PointVector>
points()
const;
550 virtual ~RelationshipMatrix();
552 virtual bool equals()
const;
554 virtual bool disjoint()
const;
555 virtual bool covers()
const;
556 virtual bool coveredBy()
const;
557 virtual bool within()
const;
558 virtual bool touches()
const;
559 virtual bool overlaps()
const;
560 virtual bool crosses()
const;
561 virtual bool contains()
const;
576 Handle(
const Implementation::Ptr&);
578 Handle(
const DtPoint&,
const DtProj& proj);
581 DtPoint point()
const;
582 DtPoint pointWithHeight()
const;
583 DtPoint pointWithoutHeight()
const;
593 typedef std::vector<DtFeatureGeometry::Path>
Vector;
598 const DtPoint& p1,
const DtPoint& p2,
602 const DtPoint& p1,
const DtPoint& p2,
const DtPoint& p3,
605 template <
typename Container>
608 return Make(
PointVector(cont.begin(), cont.end()), proj);
611 template <
typename Iterator>
619 Handle(
const Implementation::Ptr&);
621 Path reversed()
const;
625 class DT_DLL_features DtFeatureGeometry::Handle<DtFeatureGeometry::AreaType>
626 :
public DtFeatureGeometry
629 friend class DtFeatureGeometry;
631 typedef std::vector<DtFeatureGeometry::Area>
Vector;
635 Handle(
const Implementation::Ptr&);
637 Path outerBoundary()
const;
639 unsigned numberOfHoles()
const;
640 std::auto_ptr<GeometryVector> holes()
const;
642 Path findShortestPerimeter(
Path)
const;
648 template <DtFeatureGeometry::Type T>
649 std::ostream& operator<< (std::ostream& str, const DtFeatureGeometry::Handle<T>& g)