18 #include <boost/function.hpp>
22 namespace MAKVRinTerra
40 #ifdef DtObjectDebugger_Enable
55 static const int UnknownType = -1;
56 static const int PointType = 0;
57 static const int PathType = 1;
58 static const int AreaType = 2;
79 class RelationshipMatrix;
82 typedef boost::shared_ptr<Implementation>
ImplPtr;
85 typedef boost::shared_ptr<const Implementation>
ImplCPtr;
92 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>
175 std::string description()
const;
178 std::string toWKT()
const;
181 bool isValid()
const;
184 bool isEmpty()
const;
187 bool isUnknown()
const;
190 bool isPoint()
const;
199 unsigned dimension()
const;
210 template <
typename T>
211 boost::shared_ptr<T> cast();
213 template <
typename T>
214 boost::shared_ptr<const T> cast()
const;
217 const DtProj& projection()
const;
226 void convert(
const DtProj& p);
229 void convertToLocalTopo();
237 unsigned numberOfPoints()
const;
241 std::auto_ptr<PointVector> points()
const;
244 std::auto_ptr<PointVector> pointsWithHeight()
const;
246 boost::optional<DtPoint> singlePointWithHeight()
const;
250 std::auto_ptr<PointVector> pointsWithoutHeight()
const;
253 unsigned numberOfSubGeometries()
const;
256 std::auto_ptr<GeometryVector> subGeometries()
const;
289 double length()
const;
295 Point centroid()
const;
343 virtual void lock() = 0;
344 virtual void unlock() = 0;
354 explicit Lock(
const Implementation&);
357 explicit Lock(
const Implementation&,
const Implementation&);
370 template <
typename T>
376 template <
typename T>
384 :
public boost::enable_shared_from_this<DtFeatureGeometry::Implementation>
385 #ifdef DtObjectDebugger_Enable
397 virtual ~Implementation();
399 virtual Mutex& getMutex()
const;
401 virtual std::string description()
const;
403 virtual std::string toWKT()
const;
405 virtual bool isValid()
const;
407 virtual bool isEmpty()
const;
409 virtual unsigned dimension()
const;
411 virtual Hash hash()
const;
418 virtual bool unique()
const;
421 virtual const DtProj & projection()
const = 0;
428 virtual void convert(
const DtProj &) = 0;
431 virtual void prepare();
436 virtual Type type()
const = 0;
439 virtual unsigned numberOfPoints()
const = 0;
442 virtual std::auto_ptr<PointVector> points()
const = 0;
445 virtual boost::optional<DtPoint> singlePoint()
const;
448 virtual unsigned numberOfSubGeometries()
const = 0;
451 virtual std::auto_ptr<GeometryVector> subGeometries()
const = 0;
478 virtual double length()
const = 0;
480 virtual double area()
const = 0;
483 virtual Point centroid()
const = 0;
500 virtual DtFeatureGeometry bufferWithFlatCap(
double width,
unsigned segments)
const = 0;
513 explicit Implementation();
514 explicit Implementation(
const Implementation&);
524 #ifdef DtObjectDebugger_Enable
529 typedef boost::shared_ptr<EmptyImplementation>
Ptr;
542 std::auto_ptr<PointVector>
points()
const;
576 #ifdef DtObjectDebugger_Enable
581 virtual ~RelationshipMatrix();
583 virtual bool equals()
const;
585 virtual bool disjoint()
const;
586 virtual bool covers()
const;
587 virtual bool coveredBy()
const;
588 virtual bool within()
const;
589 virtual bool touches()
const;
590 virtual bool overlaps()
const;
591 virtual bool crosses()
const;
592 virtual bool contains()
const;
611 Handle(
const Implementation::Ptr&);
617 DtPoint pointWithHeight()
const;
618 DtPoint pointWithoutHeight()
const;
628 typedef std::vector<DtFeatureGeometry::Path>
Vector;
640 template <
typename Container>
643 return Make(
PointVector(cont.begin(), cont.end()), proj);
646 template <
typename Iterator>
654 Handle(
const Implementation::Ptr&);
656 Path reversed()
const;
660 class DT_DLL_features DtFeatureGeometry::Handle<DtFeatureGeometry::AreaType>
661 :
public DtFeatureGeometry
664 friend class DtFeatureGeometry;
666 typedef std::vector<DtFeatureGeometry::Area>
Vector;
670 Handle(
const Implementation::Ptr&);
674 Path outerBoundary()
const;
676 unsigned numberOfHoles()
const;
677 std::auto_ptr<GeometryVector> holes()
const;
679 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:41
DtFeatureGeometry convexHull() const
std::vector< DtPoint > PointVector
Definition: featureGeometry.h:75
DtTaggedException< struct InvalidGeometryTag > InvalidGeometry
Definition: featureGeometry.h:45
int Type
Type of geometry represented.
Definition: featureGeometry.h:53
boost::shared_ptr< const Implementation > ImplCPtr
Shared pointer to const Implementation.
Definition: featureGeometry.h:85
Mutex * mutex2
Definition: featureGeometry.h:364
DtFeatureGeometry::Type Type
Definition: featureGeometry.h:393
DtFeatureGeometry(const Handle< T > &h)
Create a geometry from a handle.
Definition: featureGeometry.h:157
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:628
std::string Hash
DtFeatureGeometry caches the hashes for the geometries can be differentiated quickly.
Definition: featureGeometry.h:89
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:60
DT_DLL_features std::ostream & operator<<(std::ostream &, const DtFeatureTransform &)
std::ostream output.
Handle< AreaType > Area
Definition: featureGeometry.h:71
static DtFeatureGeometry MakeSet(const Container &cont)
Functions for creating set or collection geometries.
Definition: featureGeometry.h:118
Definition: featureGeometry.h:338
boost::shared_ptr< EmptyImplementation > Ptr
Definition: featureGeometry.h:529
DtFeatureGeometry intersectionWith(DtFeatureGeometry g) const
bool within(DtFeatureGeometry) const
ImplPtr myImpl
Definition: featureGeometry.h:367
DtFeatureGeometry::ImplCPtr CPtr
Definition: featureGeometry.h:391
bool overlaps(DtFeatureGeometry) const
DtFeatureGeometry boundary() const
DtTaggedException< struct BadGeometryCastTag > BadGeometryCast
Definition: featureGeometry.h:46
Handle< PointType > Point
Definition: featureGeometry.h:69
void convert(const DtProj &)
Represents some coordinate system. The terms "coordinate system", "projection", "spatial reference"...
Definition: proj.h:44
std::auto_ptr< PointVector > points() const
Mutex * mutex1
Definition: featureGeometry.h:363
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:350
Handle< PathType > Path
Definition: featureGeometry.h:70
DtFeatureGeometry unionWith(DtFeatureGeometry g) const
std::vector< DtFeatureGeometry::Area > Vector
Definition: featureGeometry.h:666
void transform(const TransformFunction &)
const DtProj & projection() const
boost::function< DtPoint(const DtPoint &)> TransformFunction
Callback for transform().
Definition: featureGeometry.h:220
unsigned numberOfSubGeometries() const
Create a new MAK exception type that inherits from boost::exception. Tag is what differentiates this ...
Definition: taggedException.h:15
static DtFeatureGeometry::Path Make(Iterator i, Iterator end, const DtProj &proj)
Definition: featureGeometry.h:647
bool covers(DtFeatureGeometry) const
bool intersects(DtFeatureGeometry) const
std::auto_ptr< GeometryVector > subGeometries() const
DtFeatureGeometry Unknown
Definition: featureGeometry.h:68
std::vector< DtFeatureGeometry > GeometryVector
Definition: featureGeometry.h:74
DtProj::CPtr myProjection
Definition: featureGeometry.h:571
Implementation which represents an empty geometry. Empty geometry do have 0 points, do not intersect with any other geometries, and are infinitely far away from all other geometries.
Definition: featureGeometry.h:522
unsigned numberOfPoints() const
DtFeatureGeometry bufferWithFlatCap(double width, unsigned segments) const
static DtFeatureGeometry::Path Make(const Container &cont, const DtProj &proj)
Definition: featureGeometry.h:641
bool touches(DtFeatureGeometry) const
double distanceTo(DtFeatureGeometry, const DtProj &) const
Hash myHash
Definition: featureGeometry.h:516
boost::shared_ptr< Implementation > ImplPtr
Shared pointer to Implementation.
Definition: featureGeometry.h:79
bool crosses(DtFeatureGeometry) const
DtFeatureGeometry::ImplPtr Ptr
Definition: featureGeometry.h:390
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:371
Represents a feature geometry.
Definition: featureGeometry.h:39
DtFeatureGeometry & operator=(const Handle< T > &h)
Definition: featureGeometry.h:165
static DtFeatureGeometry MakeSet(Iterator i, Iterator end)
Functions for creating set or collection geometries.
Definition: featureGeometry.h:124