VR-Forces 4.10 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) 2020 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 #ifdef DtObjectDebugger_Enable
24  , public DtObjectDebugger<DtAreaFeature>
25 #endif
26  {
27  public:
28 
30  static const char* TypeName;
31 
32  typedef boost::shared_ptr<DtAreaFeature> Ptr;
33  typedef boost::shared_ptr<const DtAreaFeature> CPtr;
34 
35  DtAreaFeature* clone() const = 0;
36 
38  virtual DtFeatureGeometry::Area area() const;
39  };
40 
42 
44  {
45  public:
48  {
50  std::string type;
51 
53  double buffer;
54 
56  bool clip;
57 
58  explicit Config(
59  const std::string& type, double buffer=0, bool clip=false);
60 
61  bool operator<(const Config& other) const;
62  };
63 
64  struct AreaCollector;
65 
66  explicit DtAreaFeatureSetAdapter(
67  DtFeatureSet* fs, const DtProj& proj, const Config& cfg);
68 
69  std::string label() const;
70  void forEachFeatureParallel(const ForEachFunction& func) const;
71  DetachCallback forEachFeatureAsync(const ForEachFunction&) const;
72  DtAreaFeatureSet* filter(
73  const DtQuery& query, const boost::optional<DtFeatureGeometry>&, DtLoadType) const;
74  DtAreaFeatureSet* clone() const;
75  bool loaded(double) const;
76  DetachCallback addLoadedCallback(const LoadedCallback&) const;
77  unsigned numberOfFeatures() const;
78  bool elided() const;
79  bool empty() const;
80 
81  protected:
82  explicit DtAreaFeatureSetAdapter(
83  DtFeatureSet* fs, const DtAreaFeatureSetAdapter& from);
84 
85  void addEnclosingGeometry(const boost::optional<DtFeatureGeometry>& geom);
86 
87  boost::scoped_ptr<DtFeatureSet> myFeatureSet;
88  boost::optional<DtFeatureGeometry> myEnclosingGeometry;
91  };
92 
93  template <typename T>
95  : public DtAreaFeature
96 #ifdef DtObjectDebugger_Enable
97  , public DtObjectDebugger< DtFeatureWrapper<DtAreaFeature,T> >
98 #endif
99  {
100  public:
101  typedef boost::shared_ptr<DtFeatureWrapper> Ptr;
102  typedef boost::shared_ptr<const DtFeatureWrapper> CPtr;
103 
105  {
106  return new DtFeatureWrapper(*this);
107  }
108 
110  {
111  return myWrapper.wrappedFeature().area();
112  }
113 
115  {
116  return area();
117  }
118 
120  {
121  myWrapper.forEachAttribute(func);
122  }
123 
124  unsigned numberOfAttributes(const Key::String& str) const
125  {
126  return myWrapper.numberOfAttributes(str);
127  }
128 
129  boost::optional<Attribute> attribute(const Key& key) const
130  {
131  return myWrapper.attribute(key);
132  }
133 
135  {
136  return myWrapper.addDeleteCallback(callback);
137  }
138 
139  bool isDeleted() const
140  {
141  return myWrapper.isDeleted();
142  }
143 
144  void setDeleted()
145  {
146  myWrapper.setDeleted();
147  }
148 
149  explicit DtFeatureWrapper(const DtFeatureWrapper& from)
150  : myWrapper(from.myWrapper)
151  {
152  }
153 
155  : myWrapper(f)
156  {
157  }
158 
160  : myWrapper(f)
161  {
162  }
163 
164  explicit DtFeatureWrapper(const DtAreaFeature& f)
165  : myWrapper(f.clone())
166  {
167  }
168 
169  private:
171  };
172 }
173 
Represents a set of DtFeature objects or others which conform to the DtFeature concept.
Definition: featureSet.h:101
boost::function< void(const Feature &)> ForEachFunction
Callback type type for iterating through features.
Definition: featureSet.h:153
#define DT_DLL_features
stop complaining about multiple independent base classes for boost::noncopyable this should probably ...
Definition: featuresDefines.h:41
Feature which has been processed to be an area.
Definition: areaFeature.h:21
DtFeatureWrapper(const DtFeatureWrapper &from)
Definition: areaFeature.h:149
boost::scoped_ptr< DtFeatureSet > myFeatureSet
Definition: areaFeature.h:87
boost::function< void()> DetachCallback
Callback type for disconnecting other callbacks.
Definition: featureSet.h:125
bool clip
Clip features to page table cells.
Definition: areaFeature.h:56
boost::shared_ptr< const DtFeatureWrapper > CPtr
Definition: areaFeature.h:102
Key used to lookup attributes.
Definition: feature.h:68
DtProj::CPtr myProjection
Definition: areaFeature.h:89
Wraps a feature object and makes sure all the callbacks are unhooked correctly In order to wrap a fea...
Definition: feature.h:301
DtFeatureWrapper * clone() const
Definition: feature.h:376
double buffer
Meters to buffer object.
Definition: areaFeature.h:53
DtFeatureWrapper< DtFeature, DtAreaFeature > myWrapper
Definition: areaFeature.h:170
void forEachAttribute(ForEachFunction func) const
Calls the provided callback on each attribute.
Definition: areaFeature.h:119
DtFeatureWrapper(const DtAreaFeature::Ptr &f)
Definition: areaFeature.h:159
boost::optional< Attribute > attribute(const Key &key) const
Get attribute at a certain key.
Definition: areaFeature.h:129
#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
Config myConfig
Definition: areaFeature.h:90
DtFeatureSetTemplate< DtAreaFeature > DtAreaFeatureSet
Definition: areaFeature.h:41
boost::shared_ptr< const DtAreaFeature > CPtr
Definition: areaFeature.h:33
static const char * TypeName
&quot;area&quot;
Definition: areaFeature.h:30
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
DetachCallback addDeleteCallback(const DeleteCallback &callback) const
Add a user supplied callback to the feature to be called when the feature is deleted.
Definition: areaFeature.h:134
boost::function< void(const Key &, const Attribute &)> ForEachFunction
Callback used to iterating through attributes with ForEachAttribute.
Definition: feature.h:151
Definition: areaFeature.h:43
Represents some coordinate system.
Definition: proj.h:44
Represents a set of characeters a DtFeature object can have.
Definition: query.h:38
boost::function< void()> DeleteCallback
User supplied callback called when feature is deleted.
Definition: feature.h:183
DtFeatureWrapper * clone() const
Return a pointer to an object which represents the current feature.
Definition: areaFeature.h:104
DtFeatureWrapper(const DtAreaFeature &f)
Definition: areaFeature.h:164
void setDeleted()
Definition: areaFeature.h:144
boost::shared_ptr< const DtProj > CPtr
Definition: proj.h:48
unsigned numberOfAttributes(const Key::String &str) const
Definition: areaFeature.h:124
bool isDeleted() const
Check to see if feature has been deleted.
Definition: areaFeature.h:139
DtFeatureGeometry geometry() const
Get the geometry associated with this feature.
Definition: areaFeature.h:114
DtFeatureWrapper(const DtFeatureWrapper &from)
Copy constructor.
Definition: feature.h:388
DtFeatureGeometry::Area area() const
Get processed area.
Definition: areaFeature.h:109
std::string type
Query type name.
Definition: areaFeature.h:50
DtLoadType
Used to indicate whether to load features.
Definition: featureSet.h:36
DtFeatureWrapper(DtAreaFeature *f)
Definition: areaFeature.h:154
boost::optional< DtFeatureGeometry > myEnclosingGeometry
Definition: areaFeature.h:88
Represents a GIS feature.
Definition: feature.h:37
boost::function< void()> LoadedCallback
Callback type type for async notification of feature set loading.
Definition: featureSet.h:156
Configuration object for processing areas.
Definition: areaFeature.h:47
Represents a feature geometry.
Definition: featureGeometry.h:35
boost::shared_ptr< DtAreaFeature > Ptr
Definition: areaFeature.h:32
boost::shared_ptr< DtFeatureWrapper > Ptr
Definition: areaFeature.h:101

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)