VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 unioned;
55 
56  explicit Config(
57  const std::string& type, double buffer=0, bool unioned=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 empty() const;
77 
78  protected:
79  explicit DtAreaFeatureSetAdapter(
80  DtFeatureSet* fs, const DtAreaFeatureSetAdapter& from);
81 
82  boost::scoped_ptr<DtFeatureSet> myFeatureSet;
85  };
86 
87  template <typename T>
89  : public DtAreaFeature
90  //, public DtObjectDebugger< DtFeatureWrapper<DtAreaFeature,T> >
91  {
92  public:
94  {
95  return new DtFeatureWrapper(*this);
96  }
97 
99  {
100  return myWrapper.wrappedFeature().area();
101  }
102 
104  {
105  return area();
106  }
107 
109  {
110  myWrapper.forEachAttribute(func);
111  }
112 
113  unsigned numberOfAttributes(const Key::String& str) const
114  {
115  return myWrapper.numberOfAttributes(str);
116  }
117 
118  boost::optional<Attribute> attribute(const Key& key) const
119  {
120  return myWrapper.attribute(key);
121  }
122 
124  {
125  return myWrapper.addDeleteCallback(callback);
126  }
127 
128  bool isDeleted() const
129  {
130  return myWrapper.isDeleted();
131  }
132 
133  void setDeleted()
134  {
135  myWrapper.setDeleted();
136  }
137 
138  explicit DtFeatureWrapper(const DtFeatureWrapper& from)
139  : myWrapper(from.myWrapper)
140  {
141  }
142 
144  : myWrapper(f)
145  {
146  }
147 
149  : myWrapper(f)
150  {
151  }
152 
153  explicit DtFeatureWrapper(const DtAreaFeature& f)
154  : myWrapper(f.clone())
155  {
156  }
157 
158  private:
160  };
161 }
162 

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)