VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
pathFeature.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <features/feature.h>
13 #include <features/featureSet.h>
14 
15 namespace MAKVRinTerra
16 {
18  {
19  public:
20  typedef boost::shared_ptr<DtPathFeature> Ptr;
21  typedef boost::shared_ptr<const DtPathFeature> CPtr;
22 
23  enum Direction
24  {
27  ONE_WAY_BACKWARD
28  };
29 
30  static const char* TypeName;
31 
32  virtual DtPathFeature* clone() const = 0;
33 
34  virtual DtFeatureGeometry::Path pathGeometry() const = 0;
35 
36  virtual Direction direction() const;
37  virtual boost::optional<unsigned> numLanes() const;
38  virtual boost::optional<double> width() const;
39  virtual boost::optional<double> medianWidth() const;
40  virtual boost::optional<std::string> roadName() const;
41  virtual bool isClosed() const;
42  };
43 
45 
47  {
48  public:
49  static DtPathFeatureSet* MakeSet(DtFeatureSet*);
50 
51  explicit DtSimplePathFeature(const DtFeature& feature);
52  explicit DtSimplePathFeature(DtFeature*);
54 
55  DtFeatureGeometry geometry() const { return myPathGeometry; }
56  DtFeatureGeometry::Path pathGeometry() const { return myPathGeometry; }
57 
60 
61  boost::optional<Attribute> attribute(const Key & key) const
62  {
63  return myFeature.attribute(key);
64  }
65 
67  {
68  myFeature.forEachAttribute(f);
69  }
70 
71  unsigned numberOfAttributes(const Key::String & name) const
72  {
73  return myFeature.numberOfAttributes(name);
74  }
75 
77  {
78  return new DtSimplePathFeature(*this);
79  }
80 
82  {
83  return myFeature.addDeleteCallback(callback);
84  }
85 
86  bool isDeleted() const
87  {
88  return myFeature.isDeleted();
89  }
90 
91  private:
93  : myFeature(from.myFeature)
94  , myPathGeometry(from.myPathGeometry)
95  {
96  }
97 
100  };
101 
102  //Use on a feature set with findeachFeature to get the closest
103  //path feature to the given point. Once the closest feature
104  //has been found, call findClosestPointOnFeature() to get
105  //the closest edge and closest point on that edge.
107  {
108  public:
110 
112  const DtPoint& point,
113  const DtProj& localProj);
114 
115  void operator()(const DtPathFeature & feature);
116 
117  void findClosestPointOnFeature();
118 
119  bool foundClosestFeature() const;
120 
129  };
130 }
131 
Represents a set of DtFeature objects or others which conform to the DtFeature concept.
Definition: featureSet.h:101
#define DT_DLL_features
stop complaining about multiple independent base classes for boost::noncopyable this should probably ...
Definition: featuresDefines.h:41
double myClosestDistance
Definition: pathFeature.h:123
std::vector< DtPoint > PointVector
Definition: featureGeometry.h:75
DtPoint myClosestEdgeB
Definition: pathFeature.h:126
DtProj::CPtr myTopoProj
Definition: pathFeature.h:128
Key used to lookup attributes. The DtFeature interface is a dictionary that maps Key objects to attri...
Definition: feature.h:68
boost::shared_ptr< DtPathFeature > Ptr
Definition: pathFeature.h:20
Definition: pathFeature.h:46
bool isDeleted() const
Check to see if feature has been deleted. Note: this is not related to C++ delete or destructors...
Definition: pathFeature.h:86
DtFeatureGeometry::Path pathGeometry() const
Definition: pathFeature.h:56
DtPoint myClosestPoint
Definition: pathFeature.h:124
DtPathFeature::CPtr myClosestFeature
Definition: pathFeature.h:122
DtFeatureGeometry::Path myPathGeometry
Definition: pathFeature.h:99
boost::optional< Attribute > attribute(const Key &key) const
have to implement all the DtFeature and functions to call the same function on myFeature, like...
Definition: pathFeature.h:61
DtFeatureGeometry::Point myEntityPoint
Definition: pathFeature.h:121
boost::function< void()> DetachCallback
Callback used to detach the user from a feature so the users callback is not called anymore...
Definition: feature.h:180
DtPoint myClosestEdgeA
Definition: pathFeature.h:125
DtFeatureGeometry::PointVector PointVector
Definition: pathFeature.h:109
Direction
Definition: pathFeature.h:23
boost::function< void(const Key &, const Attribute &)> ForEachFunction
Callback used to iterating through attributes with ForEachAttribute.
Definition: feature.h:151
Handle< PointType > Point
Definition: featureGeometry.h:69
Represents some coordinate system. The terms &quot;coordinate system&quot;, &quot;projection&quot;, &quot;spatial reference&quot;...
Definition: proj.h:44
boost::function< void()> DeleteCallback
User supplied callback called when feature is deleted.
Definition: feature.h:183
static const char * TypeName
Definition: pathFeature.h:30
boost::shared_ptr< const DtPathFeature > CPtr
Definition: pathFeature.h:21
unsigned numberOfAttributes(const Key::String &name) const
Definition: pathFeature.h:71
Definition: pathFeature.h:25
DtSimplePathFeature(const DtSimplePathFeature &from)
Definition: pathFeature.h:92
boost::shared_ptr< const DtProj > CPtr
Definition: proj.h:48
Handle< PathType > Path
Definition: featureGeometry.h:70
DtFeatureSetTemplate< DtPathFeature > DtPathFeatureSet
Definition: pathFeature.h:44
Definition: pathFeature.h:106
DtFeatureGeometry geometry() const
Get the geometry associated with this feature. GIS features each typically each associated with one g...
Definition: pathFeature.h:55
Definition: pathFeature.h:17
DtSimplePathFeature * clone() const
Return a pointer to an object which represents the current feature. In order to enable paging and eff...
Definition: pathFeature.h:76
DtProj::CPtr myLocalProj
Definition: pathFeature.h:127
DtFeatureWrapper< DtFeature > myFeature
Definition: pathFeature.h:98
Represents a GIS feature. Features consist of a DtFeatureGeometry (2.5D geometric vector data) and a ...
Definition: feature.h:37
void forEachAttribute(ForEachFunction f) const
Calls the provided callback on each attribute.
Definition: pathFeature.h:66
DetachCallback addDeleteCallback(const DeleteCallback &callback) const
Add a user supplied callback to the feature to be called when the feature is deleted. If the feature is already deleted the callback may or may not be called by the implementation of this function. The callback is guaranteed to only be called once.
Definition: pathFeature.h:81
Represents a feature geometry.
Definition: featureGeometry.h:39
Definition: point.h:34

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)