VR-Forces 4.2 Class Documentation
obstacleFeature.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <features/feature.h>
13 #include <features/featureSet.h>
15 
16 namespace MAKVRinTerra
17 {
23  {
24  public:
25 
27  static const char* TypeName;
28 
29  typedef boost::shared_ptr<DtObstacleFeature> Ptr;
30  typedef boost::shared_ptr<const DtObstacleFeature> CPtr;
31 
32  static CPtr GetPtr(const DtObstacleFeature&);
33 
34  DtFeature::CPtr getPtr() const;
35  virtual CPtr getObstaclePtr() const = 0;
36 
38  DtFeatureGeometry geometry() const;
39 
41  virtual DtFeatureGeometry::Area obstacle() const = 0;
42  };
43 
45 
47  {
48  public:
51  {
53  std::string type;
54 
56  double buffer;
57 
59  bool unioned;
60 
61  explicit Config(
62  const std::string& type, double buffer=0, bool unioned=false);
63 
64  bool operator<(const Config& other) const;
65  };
66 
67  struct ObstacleCollector;
68 
70  DtFeatureSet* fs, const DtProj& proj, const Config& cfg);
71 
72  std::string label() const;
73  void forEachFeature(ForEachFunction func, DtWaitType) const;
74  DtObstacleFeatureSet* filter(const DtQuery& query, DtLoadType) const;
75  DtObstacleFeatureSet* clone() const;
76  bool loaded(double) const;
77  unsigned numberOfFeatures() const;
78  bool empty() const;
79 
80  protected:
82  DtFeatureSet* fs, const DtObstacleFeatureSetAdapter& from);
83 
84  boost::scoped_ptr<DtFeatureSet> myFeatureSet;
87  };
88 
90  {
91  void operator()(const DtFeature& feature);
92 
93  void addFeature(const DtFeature& feature);
94 
96  boost::optional<double> width = boost::none_t(),
97  boost::optional<double> length = boost::none_t(),
98  boost::optional<double> rotation = boost::none_t());
99 
101 
102  ObstacleCollector(const DtProj& proj, const Config& cfg);
103 
108  };
109 
110  template <>
112  {
113  public:
116 
117  DtFeatureGeometry geometry() const { return myWrappedFeature->geometry(); }
118  DtFeatureGeometry::Area obstacle() const { return myWrappedFeature->obstacle(); }
119 
121  {
122  myWrappedFeature->forEachAttribute(func);
123  }
124 
125  unsigned numberOfAttributes(const Key::String& str) const
126  {
127  return myWrappedFeature->numberOfAttributes(str);
128  }
129 
130  boost::optional<Attribute> attribute(const Key& key) const
131  {
132  return myWrappedFeature->attribute(key);
133  }
134 
135  protected:
137  : myWrappedFeature(f.getObstaclePtr()) { }
138 
140  : myWrappedFeature(f) { }
141 
142  virtual DtFeatureWrapper* clone() const = 0;
143 
145  };
146 }

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)