18 #include <boost/function.hpp>
22 namespace MAKVRinTerra
49 static const int UnknownType = -1;
50 static const int PointType = 0;
51 static const int PathType = 1;
52 static const int AreaType = 2;
73 class RelationshipMatrix;
76 typedef boost::shared_ptr<Implementation>
ImplPtr;
79 typedef boost::shared_ptr<const Implementation>
ImplCPtr;
86 static std::string ToString(
Type);
93 static Area MakeBox(
Point,
double length,
double width,
double rotation);
94 static Area MakeBox(
const DtProj&,
double xmin,
double ymin,
double xmax,
double ymax);
100 static Area MakeArea(
const DtProj&,
const std::vector<DtPoint>& points);
101 static Area MakeArea(
const DtProj&,
const std::vector<DtVector>& points);
102 static Path MakePath(
const DtProj&,
const std::vector<DtPoint>& points);
103 static Path MakePath(
const DtProj&,
const std::vector<DtVector>& points);
111 template <
typename Container>
117 template <
typename Iterator>
169 std::string description()
const;
172 std::string toWKT()
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;
337 virtual void lock() = 0;
338 virtual void unlock() = 0;
348 explicit Lock(
const Implementation&);
351 explicit Lock(
const Implementation&,
const Implementation&);
364 template <
typename T>
370 template <
typename T>
378 :
public boost::enable_shared_from_this<DtFeatureGeometry::Implementation>
389 virtual ~Implementation();
391 virtual Mutex& getMutex()
const;
393 virtual std::string description()
const;
395 virtual std::string toWKT()
const;
397 virtual bool isValid()
const;
399 virtual bool isEmpty()
const;
401 virtual unsigned dimension()
const;
403 virtual Hash hash()
const;
410 virtual bool unique()
const;
413 virtual const DtProj & projection()
const = 0;
420 virtual void convert(
const DtProj &) = 0;
423 virtual void prepare();
428 virtual Type type()
const = 0;
431 virtual unsigned numberOfPoints()
const = 0;
434 virtual std::auto_ptr<PointVector> points()
const = 0;
437 virtual boost::optional<DtPoint> singlePoint()
const;
440 virtual unsigned numberOfSubGeometries()
const = 0;
443 virtual std::auto_ptr<GeometryVector> subGeometries()
const = 0;
470 virtual double length()
const = 0;
472 virtual double area()
const = 0;
475 virtual Point centroid()
const = 0;
492 virtual DtFeatureGeometry bufferWithFlatCap(
double width,
unsigned segments)
const = 0;
505 explicit Implementation();
506 explicit Implementation(
const Implementation&);
519 typedef boost::shared_ptr<EmptyImplementation>
Ptr;
532 std::auto_ptr<PointVector>
points()
const;
569 virtual ~RelationshipMatrix();
571 virtual bool equals()
const;
573 virtual bool disjoint()
const;
574 virtual bool covers()
const;
575 virtual bool coveredBy()
const;
576 virtual bool within()
const;
577 virtual bool touches()
const;
578 virtual bool overlaps()
const;
579 virtual bool crosses()
const;
580 virtual bool contains()
const;
595 Handle(
const Implementation::Ptr&);
601 DtPoint pointWithHeight()
const;
602 DtPoint pointWithoutHeight()
const;
612 typedef std::vector<DtFeatureGeometry::Path>
Vector;
624 template <
typename Container>
627 return Make(
PointVector(cont.begin(), cont.end()), proj);
630 template <
typename Iterator>
638 Handle(
const Implementation::Ptr&);
640 Path reversed()
const;
644 class DT_DLL_features DtFeatureGeometry::Handle<DtFeatureGeometry::AreaType>
645 :
public DtFeatureGeometry
648 friend class DtFeatureGeometry;
650 typedef std::vector<DtFeatureGeometry::Area>
Vector;
654 Handle(
const Implementation::Ptr&);
658 Path outerBoundary()
const;
660 unsigned numberOfHoles()
const;
661 std::auto_ptr<GeometryVector> holes()
const;
663 Path findShortestPerimeter(
Path)
const;
DtFeatureGeometry clone() const
#define DT_DLL_features
stop complaining about multiple independent base classes for boost::noncopyable this should probably ...
Definition: featuresDefines.h:36
DtFeatureGeometry convexHull() const
std::vector< DtPoint > PointVector
Definition: featureGeometry.h:69
DtTaggedException< struct InvalidGeometryTag > InvalidGeometry
Definition: featureGeometry.h:39
int Type
Type of geometry represented.
Definition: featureGeometry.h:47
boost::shared_ptr< const Implementation > ImplCPtr
Shared pointer to const Implementation.
Definition: featureGeometry.h:79
Mutex * mutex2
Definition: featureGeometry.h:358
DtFeatureGeometry::Type Type
Definition: featureGeometry.h:385
DtFeatureGeometry(const Handle< T > &h)
Create a geometry from a handle.
Definition: featureGeometry.h:151
DtFeatureGeometry buffer(double width, unsigned segments) const
bool contains(DtFeatureGeometry) const
DtFeatureGeometry differenceWith(DtFeatureGeometry g) const
boost::optional< DtPoint > singlePoint() const
std::vector< DtFeatureGeometry::Path > Vector
Definition: featureGeometry.h:612
std::string Hash
DtFeatureGeometry caches the hashes for the geometries can be differentiated quickly.
Definition: featureGeometry.h:83
bool equals(DtFeatureGeometry) const
ImplPtr implementation()
Get implementation of this geometry.
#define DT_DEFINE_OBJECT_DEBUGGER_NAME(type)
Definition: objectCounter.h:265
Default on in debug, off in release.
Definition: objectCounter.h:31
Definition: featureGeometry.h:54
DT_DLL_features std::ostream & operator<<(std::ostream &, const DtFeatureTransform &)
std::ostream output.
Handle< AreaType > Area
Definition: featureGeometry.h:65
static DtFeatureGeometry MakeSet(const Container &cont)
Definition: featureGeometry.h:112
Definition: featureGeometry.h:332
boost::shared_ptr< EmptyImplementation > Ptr
Definition: featureGeometry.h:519
DtFeatureGeometry intersectionWith(DtFeatureGeometry g) const
bool within(DtFeatureGeometry) const
ImplPtr myImpl
Definition: featureGeometry.h:361
DtFeatureGeometry::ImplCPtr CPtr
Definition: featureGeometry.h:383
bool overlaps(DtFeatureGeometry) const
DtFeatureGeometry boundary() const
DtTaggedException< struct BadGeometryCastTag > BadGeometryCast
Definition: featureGeometry.h:40
Handle< PointType > Point
Definition: featureGeometry.h:63
void convert(const DtProj &)
Represents some coordinate system.
Definition: proj.h:44
std::auto_ptr< PointVector > points() const
Mutex * mutex1
Definition: featureGeometry.h:357
boost::shared_ptr< const DtProj > CPtr
Definition: proj.h:48
Scoped lock which will lock two Implementation mutexes in a predefined order to avoid deadlock...
Definition: featureGeometry.h:344
Handle< PathType > Path
Definition: featureGeometry.h:64
DtFeatureGeometry unionWith(DtFeatureGeometry g) const
std::vector< DtFeatureGeometry::Area > Vector
Definition: featureGeometry.h:650
void transform(const TransformFunction &)
const DtProj & projection() const
boost::function< DtPoint(const DtPoint &)> TransformFunction
Callback for transform().
Definition: featureGeometry.h:214
unsigned numberOfSubGeometries() const
Create a new MAK exception type that inherits from boost::exception.
Definition: taggedException.h:15
static DtFeatureGeometry::Path Make(Iterator i, Iterator end, const DtProj &proj)
Definition: featureGeometry.h:631
bool covers(DtFeatureGeometry) const
bool intersects(DtFeatureGeometry) const
std::auto_ptr< GeometryVector > subGeometries() const
DtFeatureGeometry Unknown
Definition: featureGeometry.h:62
std::vector< DtFeatureGeometry > GeometryVector
Definition: featureGeometry.h:68
DtProj::CPtr myProjection
Definition: featureGeometry.h:561
Implementation which represents an empty geometry.
Definition: featureGeometry.h:514
unsigned numberOfPoints() const
DtFeatureGeometry bufferWithFlatCap(double width, unsigned segments) const
static DtFeatureGeometry::Path Make(const Container &cont, const DtProj &proj)
Definition: featureGeometry.h:625
bool touches(DtFeatureGeometry) const
double distanceTo(DtFeatureGeometry, const DtProj &) const
Hash myHash
Definition: featureGeometry.h:508
boost::shared_ptr< Implementation > ImplPtr
Shared pointer to Implementation.
Definition: featureGeometry.h:73
bool crosses(DtFeatureGeometry) const
DtFeatureGeometry::ImplPtr Ptr
Definition: featureGeometry.h:382
DtFeatureGeometry::Point closestPointTo(DtFeatureGeometry g, const DtProj &, double *distanceTo=0) const
boost::shared_ptr< T > cast()
Get implementation as a specific type.
Definition: featureGeometry.h:365
Represents a feature geometry.
Definition: featureGeometry.h:35
DtFeatureGeometry & operator=(const Handle< T > &h)
Definition: featureGeometry.h:159
static DtFeatureGeometry MakeSet(Iterator i, Iterator end)
Definition: featureGeometry.h:118