VR-Forces 4.8 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 
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:151
#define DT_DLL_features
stop complaining about multiple independent base classes for boost::noncopyable this should probably ...
Definition: featuresDefines.h:36
Feature which has been processed to be an area.
Definition: areaFeature.h:21
DtFeatureWrapper(const DtFeatureWrapper &from)
Definition: areaFeature.h:145
boost::scoped_ptr< DtFeatureSet > myFeatureSet
Definition: areaFeature.h:85
boost::function< void()> DetachCallback
Callback type for disconnecting other callbacks.
Definition: featureSet.h:123
bool clip
Clip features to page table cells.
Definition: areaFeature.h:54
boost::shared_ptr< const DtFeatureWrapper > CPtr
Definition: areaFeature.h:98
Key used to lookup attributes.
Definition: feature.h:66
DtProj::CPtr myProjection
Definition: areaFeature.h:87
Wraps a feature object and makes sure all the callbacks are unhooked correctly In order to wrap a fea...
Definition: feature.h:299
DtFeatureWrapper * clone() const
Definition: feature.h:372
double buffer
Meters to buffer object.
Definition: areaFeature.h:51
DtFeatureWrapper< DtFeature, DtAreaFeature > myWrapper
Definition: areaFeature.h:166
void forEachAttribute(ForEachFunction func) const
Calls the provided callback on each attribute.
Definition: areaFeature.h:115
DtFeatureWrapper(const DtAreaFeature::Ptr &f)
Definition: areaFeature.h:155
boost::optional< Attribute > attribute(const Key &key) const
Get attribute at a certain key.
Definition: areaFeature.h:125
#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:54
Config myConfig
Definition: areaFeature.h:88
DtFeatureSetTemplate< DtAreaFeature > DtAreaFeatureSet
Definition: areaFeature.h:39
boost::shared_ptr< const DtAreaFeature > CPtr
Definition: areaFeature.h:31
static const char * TypeName
&quot;area&quot;
Definition: areaFeature.h:28
boost::function< void()> DetachCallback
Callback used to detach the user from a feature so the users callback is not called anymore...
Definition: feature.h:178
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:130
boost::function< void(const Key &, const Attribute &)> ForEachFunction
Callback used to iterating through attributes with ForEachAttribute.
Definition: feature.h:149
Definition: areaFeature.h:41
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:181
DtFeatureWrapper * clone() const
Return a pointer to an object which represents the current feature.
Definition: areaFeature.h:100
DtFeatureWrapper(const DtAreaFeature &f)
Definition: areaFeature.h:160
void setDeleted()
Definition: areaFeature.h:140
boost::shared_ptr< const DtProj > CPtr
Definition: proj.h:48
unsigned numberOfAttributes(const Key::String &str) const
Definition: areaFeature.h:120
bool isDeleted() const
Check to see if feature has been deleted.
Definition: areaFeature.h:135
DtFeatureGeometry geometry() const
Get the geometry associated with this feature.
Definition: areaFeature.h:110
DtFeatureWrapper(const DtFeatureWrapper &from)
Copy constructor.
Definition: feature.h:384
DtFeatureGeometry::Area area() const
Get processed area.
Definition: areaFeature.h:105
std::string type
Query type name.
Definition: areaFeature.h:48
DtLoadType
Used to indicate whether to load features.
Definition: featureSet.h:36
DtFeatureWrapper(DtAreaFeature *f)
Definition: areaFeature.h:150
boost::optional< DtFeatureGeometry > myEnclosingGeometry
Definition: areaFeature.h:86
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:154
Configuration object for processing areas.
Definition: areaFeature.h:45
Represents a feature geometry.
Definition: featureGeometry.h:35
boost::shared_ptr< DtAreaFeature > Ptr
Definition: areaFeature.h:30
boost::shared_ptr< DtFeatureWrapper > Ptr
Definition: areaFeature.h:97

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)