VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
areaFeature.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>
14 
15 namespace MAKVRinTerra
16 {
22  : public DtFeature
23  , public DtObjectDebugger<DtAreaFeature>
24  {
25  public:
26 
28  static const char* TypeName;
29 
30  typedef boost::shared_ptr<DtAreaFeature> Ptr;
31  typedef boost::shared_ptr<const DtAreaFeature> CPtr;
32 
33  DtAreaFeature* clone() const = 0;
34 
36  virtual DtFeatureGeometry::Area area() const;
37  };
38 
40 
42  {
43  public:
46  {
48  std::string type;
49 
51  double buffer;
52 
54  bool clip;
55 
56  explicit Config(
57  const std::string& type, double buffer=0, bool clip=false);
58 
59  bool operator<(const Config& other) const;
60  };
61 
62  struct AreaCollector;
63 
64  explicit DtAreaFeatureSetAdapter(
65  DtFeatureSet* fs, const DtProj& proj, const Config& cfg);
66 
67  std::string label() const;
68  void forEachFeatureParallel(const ForEachFunction& func) const;
69  DetachCallback forEachFeatureAsync(const ForEachFunction&) const;
70  DtAreaFeatureSet* filter(
71  const DtQuery& query, const boost::optional<DtFeatureGeometry>&, DtLoadType) const;
72  DtAreaFeatureSet* clone() const;
73  bool loaded(double) const;
74  DetachCallback addLoadedCallback(const LoadedCallback&) const;
75  unsigned numberOfFeatures() const;
76  bool elided() const;
77  bool empty() const;
78 
79  protected:
80  explicit DtAreaFeatureSetAdapter(
81  DtFeatureSet* fs, const DtAreaFeatureSetAdapter& from);
82 
83  void addEnclosingGeometry(const boost::optional<DtFeatureGeometry>& geom);
84 
85  boost::scoped_ptr<DtFeatureSet> myFeatureSet;
86  boost::optional<DtFeatureGeometry> myEnclosingGeometry;
89  };
90 
91  template <typename T>
93  : public DtAreaFeature
94  //, public DtObjectDebugger< DtFeatureWrapper<DtAreaFeature,T> >
95  {
96  public:
97  typedef boost::shared_ptr<DtFeatureWrapper> Ptr;
98  typedef boost::shared_ptr<const DtFeatureWrapper> CPtr;
99 
101  {
102  return new DtFeatureWrapper(*this);
103  }
104 
106  {
107  return myWrapper.wrappedFeature().area();
108  }
109 
111  {
112  return area();
113  }
114 
116  {
117  myWrapper.forEachAttribute(func);
118  }
119 
120  unsigned numberOfAttributes(const Key::String& str) const
121  {
122  return myWrapper.numberOfAttributes(str);
123  }
124 
125  boost::optional<Attribute> attribute(const Key& key) const
126  {
127  return myWrapper.attribute(key);
128  }
129 
131  {
132  return myWrapper.addDeleteCallback(callback);
133  }
134 
135  bool isDeleted() const
136  {
137  return myWrapper.isDeleted();
138  }
139 
140  void setDeleted()
141  {
142  myWrapper.setDeleted();
143  }
144 
145  explicit DtFeatureWrapper(const DtFeatureWrapper& from)
146  : myWrapper(from.myWrapper)
147  {
148  }
149 
151  : myWrapper(f)
152  {
153  }
154 
156  : myWrapper(f)
157  {
158  }
159 
160  explicit DtFeatureWrapper(const DtAreaFeature& f)
161  : myWrapper(f.clone())
162  {
163  }
164 
165  private:
167  };
168 }
169 

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)