18 #include <boost/function.hpp>
22 namespace MAKVRinTerra
36 #ifdef DtObjectDebugger_Enable
51 static const int UnknownType = -1;
52 static const int PointType = 0;
53 static const int PathType = 1;
54 static const int AreaType = 2;
75 class RelationshipMatrix;
78 typedef boost::shared_ptr<Implementation>
ImplPtr;
81 typedef boost::shared_ptr<const Implementation>
ImplCPtr;
88 static std::string ToString(
Type);
95 static Area MakeBox(
Point,
double length,
double width,
double rotation);
96 static Area MakeBox(
const DtProj&,
double xmin,
double ymin,
double xmax,
double ymax);
102 static Area MakeArea(
const DtProj&,
const std::vector<DtPoint>& points);
103 static Area MakeArea(
const DtProj&,
const std::vector<DtVector>& points);
104 static Path MakePath(
const DtProj&,
const std::vector<DtPoint>& points);
105 static Path MakePath(
const DtProj&,
const std::vector<DtVector>& points);
113 template <
typename Container>
119 template <
typename Iterator>
171 std::string description()
const;
174 std::string toWKT()
const;
177 bool isValid()
const;
180 bool isEmpty()
const;
183 bool isUnknown()
const;
186 bool isPoint()
const;
195 unsigned dimension()
const;
206 template <
typename T>
207 boost::shared_ptr<T> cast();
209 template <
typename T>
210 boost::shared_ptr<const T> cast()
const;
213 const DtProj& projection()
const;
222 void convert(
const DtProj& p);
225 void convertToLocalTopo();
233 unsigned numberOfPoints()
const;
237 std::auto_ptr<PointVector> points()
const;
240 std::auto_ptr<PointVector> pointsWithHeight()
const;
242 boost::optional<DtPoint> singlePointWithHeight()
const;
246 std::auto_ptr<PointVector> pointsWithoutHeight()
const;
249 unsigned numberOfSubGeometries()
const;
252 std::auto_ptr<GeometryVector> subGeometries()
const;
285 double length()
const;
291 Point centroid()
const;
339 virtual void lock() = 0;
340 virtual void unlock() = 0;
350 explicit Lock(
const Implementation&);
353 explicit Lock(
const Implementation&,
const Implementation&);
366 template <
typename T>
372 template <
typename T>
380 :
public boost::enable_shared_from_this<DtFeatureGeometry::Implementation>
381 #ifdef DtObjectDebugger_Enable
393 virtual ~Implementation();
395 virtual Mutex& getMutex()
const;
397 virtual std::string description()
const;
399 virtual std::string toWKT()
const;
401 virtual bool isValid()
const;
403 virtual bool isEmpty()
const;
405 virtual unsigned dimension()
const;
407 virtual Hash hash()
const;
414 virtual bool unique()
const;
417 virtual const DtProj & projection()
const = 0;
424 virtual void convert(
const DtProj &) = 0;
427 virtual void prepare();
432 virtual Type type()
const = 0;
435 virtual unsigned numberOfPoints()
const = 0;
438 virtual std::auto_ptr<PointVector> points()
const = 0;
441 virtual boost::optional<DtPoint> singlePoint()
const;
444 virtual unsigned numberOfSubGeometries()
const = 0;
447 virtual std::auto_ptr<GeometryVector> subGeometries()
const = 0;
474 virtual double length()
const = 0;
476 virtual double area()
const = 0;
479 virtual Point centroid()
const = 0;
496 virtual DtFeatureGeometry bufferWithFlatCap(
double width,
unsigned segments)
const = 0;
509 explicit Implementation();
510 explicit Implementation(
const Implementation&);
520 #ifdef DtObjectDebugger_Enable
525 typedef boost::shared_ptr<EmptyImplementation>
Ptr;
538 std::auto_ptr<PointVector>
points()
const;
572 #ifdef DtObjectDebugger_Enable
577 virtual ~RelationshipMatrix();
579 virtual bool equals()
const;
581 virtual bool disjoint()
const;
582 virtual bool covers()
const;
583 virtual bool coveredBy()
const;
584 virtual bool within()
const;
585 virtual bool touches()
const;
586 virtual bool overlaps()
const;
587 virtual bool crosses()
const;
588 virtual bool contains()
const;
607 Handle(
const Implementation::Ptr&);
613 DtPoint pointWithHeight()
const;
614 DtPoint pointWithoutHeight()
const;
624 typedef std::vector<DtFeatureGeometry::Path>
Vector;
636 template <
typename Container>
639 return Make(
PointVector(cont.begin(), cont.end()), proj);
642 template <
typename Iterator>
650 Handle(
const Implementation::Ptr&);
652 Path reversed()
const;
656 class DT_DLL_features DtFeatureGeometry::Handle<DtFeatureGeometry::AreaType>
657 :
public DtFeatureGeometry
660 friend class DtFeatureGeometry;
662 typedef std::vector<DtFeatureGeometry::Area>
Vector;
666 Handle(
const Implementation::Ptr&);
670 Path outerBoundary()
const;
672 unsigned numberOfHoles()
const;
673 std::auto_ptr<GeometryVector> holes()
const;
675 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:71
DtTaggedException< struct InvalidGeometryTag > InvalidGeometry
Definition: featureGeometry.h:41
int Type
Type of geometry represented.
Definition: featureGeometry.h:49
boost::shared_ptr< const Implementation > ImplCPtr
Shared pointer to const Implementation.
Definition: featureGeometry.h:81
Mutex * mutex2
Definition: featureGeometry.h:360
DtFeatureGeometry::Type Type
Definition: featureGeometry.h:389
DtFeatureGeometry(const Handle< T > &h)
Create a geometry from a handle.
Definition: featureGeometry.h:153
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:624
std::string Hash
DtFeatureGeometry caches the hashes for the geometries can be differentiated quickly.
Definition: featureGeometry.h:85
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:56
DT_DLL_features std::ostream & operator<<(std::ostream &, const DtFeatureTransform &)
std::ostream output.
Handle< AreaType > Area
Definition: featureGeometry.h:67
static DtFeatureGeometry MakeSet(const Container &cont)
Definition: featureGeometry.h:114
Definition: featureGeometry.h:334
boost::shared_ptr< EmptyImplementation > Ptr
Definition: featureGeometry.h:525
DtFeatureGeometry intersectionWith(DtFeatureGeometry g) const
bool within(DtFeatureGeometry) const
ImplPtr myImpl
Definition: featureGeometry.h:363
DtFeatureGeometry::ImplCPtr CPtr
Definition: featureGeometry.h:387
bool overlaps(DtFeatureGeometry) const
DtFeatureGeometry boundary() const
DtTaggedException< struct BadGeometryCastTag > BadGeometryCast
Definition: featureGeometry.h:42
Handle< PointType > Point
Definition: featureGeometry.h:65
void convert(const DtProj &)
Represents some coordinate system.
Definition: proj.h:44
std::auto_ptr< PointVector > points() const
Mutex * mutex1
Definition: featureGeometry.h:359
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:346
Handle< PathType > Path
Definition: featureGeometry.h:66
DtFeatureGeometry unionWith(DtFeatureGeometry g) const
std::vector< DtFeatureGeometry::Area > Vector
Definition: featureGeometry.h:662
void transform(const TransformFunction &)
const DtProj & projection() const
boost::function< DtPoint(const DtPoint &)> TransformFunction
Callback for transform().
Definition: featureGeometry.h:216
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:643
bool covers(DtFeatureGeometry) const
bool intersects(DtFeatureGeometry) const
std::auto_ptr< GeometryVector > subGeometries() const
DtFeatureGeometry Unknown
Definition: featureGeometry.h:64
std::vector< DtFeatureGeometry > GeometryVector
Definition: featureGeometry.h:70
DtProj::CPtr myProjection
Definition: featureGeometry.h:567
Implementation which represents an empty geometry.
Definition: featureGeometry.h:518
unsigned numberOfPoints() const
DtFeatureGeometry bufferWithFlatCap(double width, unsigned segments) const
static DtFeatureGeometry::Path Make(const Container &cont, const DtProj &proj)
Definition: featureGeometry.h:637
bool touches(DtFeatureGeometry) const
double distanceTo(DtFeatureGeometry, const DtProj &) const
Hash myHash
Definition: featureGeometry.h:512
boost::shared_ptr< Implementation > ImplPtr
Shared pointer to Implementation.
Definition: featureGeometry.h:75
bool crosses(DtFeatureGeometry) const
DtFeatureGeometry::ImplPtr Ptr
Definition: featureGeometry.h:386
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:367
Represents a feature geometry.
Definition: featureGeometry.h:35
DtFeatureGeometry & operator=(const Handle< T > &h)
Definition: featureGeometry.h:161
static DtFeatureGeometry MakeSet(Iterator i, Iterator end)
Definition: featureGeometry.h:120