VR-Forces Developer's Guide
 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 std::shared_ptr<DtAreaFeature> Ptr;
33  typedef std::shared_ptr<const DtAreaFeature> CPtr;
34 
35  virtual DtAreaFeature* clone() const override = 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(DtFeatureSet* fs, const DtProj& proj, const Config& cfg);
67 
68  virtual std::string label() const override;
69  virtual void forEachFeatureParallel(const ForEachFunction& func) const override;
70  virtual DetachCallback forEachFeatureAsync(const ForEachFunction&) const override;
71  virtual DtAreaFeatureSet* filter(
72  const DtQuery& query, const boost::optional<DtFeatureGeometry>&, DtLoadType) const override;
73  virtual DtAreaFeatureSet* clone() const override;
74  virtual bool loaded(double) const override;
75  virtual DetachCallback addLoadedCallback(const LoadedCallback&) const override;
76  virtual unsigned numberOfFeatures() const override;
77  virtual bool elided() const override;
78  virtual bool empty() const override;
79 
80  protected:
81  explicit DtAreaFeatureSetAdapter(
82  DtFeatureSet* fs, const DtAreaFeatureSetAdapter& from);
83 
84  void addEnclosingGeometry(const boost::optional<DtFeatureGeometry>& geom);
85 
86  const std::unique_ptr<DtFeatureSet> myFeatureSet;
87  boost::optional<DtFeatureGeometry> myEnclosingGeometry;
90  };
91 
92  template <typename T>
94  : public DtAreaFeature
95 #ifdef DtObjectDebugger_Enable
96  , public DtObjectDebugger< DtFeatureWrapper<DtAreaFeature,T> >
97 #endif
98  {
99  public:
100  typedef std::shared_ptr<DtFeatureWrapper> Ptr;
101  typedef std::shared_ptr<const DtFeatureWrapper> CPtr;
102 
103  virtual DtFeatureWrapper* clone() const override { return new DtFeatureWrapper(*this); }
104 
105  virtual DtFeatureGeometry::Area area() const override { return myWrapper.wrappedFeature().area(); }
106 
107  virtual DtFeatureGeometry geometry() const override { return area(); }
108 
109  virtual void forEachAttribute(ForEachFunction func) const override { myWrapper.forEachAttribute(func); }
110 
111  virtual unsigned numberOfAttributes(const Key::String& str) const override
112  {
113  return myWrapper.numberOfAttributes(str);
114  }
115 
116  virtual boost::optional<Attribute> attribute(const Key& key) const override { return myWrapper.attribute(key); }
117 
118  virtual DetachCallback addDeleteCallback(const DeleteCallback& callback) const override
119  {
120  return myWrapper.addDeleteCallback(callback);
121  }
122 
123  virtual bool isDeleted() const override {
124  return myWrapper.isDeleted();
125  }
126 
127  void setDeleted()
128  {
129  myWrapper.setDeleted();
130  }
131 
132  explicit DtFeatureWrapper(const DtFeatureWrapper& from)
133  : myWrapper(from.myWrapper)
134  {
135  }
136 
138  : myWrapper(f)
139  {
140  }
141 
143  : myWrapper(f)
144  {
145  }
146 
147  explicit DtFeatureWrapper(const DtAreaFeature& f)
148  : myWrapper(f.clone())
149  {
150  }
151 
152  private:
154  };
155 }
156 
Represents a set of DtFeature objects or others which conform to the DtFeature concept.
Definition: featureSet.h:105
boost::function< void(const Feature &)> ForEachFunction
Callback type type for iterating through features.
Definition: featureSet.h:160
#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. They have an additional interface which models areas ...
Definition: areaFeature.h:21
DtFeatureWrapper(const DtFeatureWrapper &from)
Definition: areaFeature.h:132
std::shared_ptr< DtFeatureWrapper > Ptr
Definition: areaFeature.h:100
boost::function< void()> DetachCallback
Callback type for disconnecting other callbacks. Functions which register callbacks return a DetachCa...
Definition: featureSet.h:132
bool clip
Clip features to page table cells.
Definition: areaFeature.h:56
Key used to lookup attributes. The DtFeature interface is a dictionary that maps Key objects to attri...
Definition: feature.h:67
std::shared_ptr< const DtProj > CPtr
Definition: proj.h:56
DtProj::CPtr myProjection
Definition: areaFeature.h:88
Wraps a feature object and makes sure all the callbacks are unhooked correctly In order to wrap a fea...
Definition: feature.h:300
DtFeatureWrapper * clone() const
Definition: feature.h:375
double buffer
Meters to buffer object.
Definition: areaFeature.h:53
DtFeatureWrapper< DtFeature, DtAreaFeature > myWrapper
Definition: areaFeature.h:153
virtual unsigned numberOfAttributes(const Key::String &str) const override
Definition: areaFeature.h:111
DtFeatureWrapper(const DtAreaFeature::Ptr &f)
Definition: areaFeature.h:142
std::shared_ptr< const DtFeatureWrapper > CPtr
Definition: areaFeature.h:101
#define DT_DEFINE_OBJECT_DEBUGGER_NAME(type)
Definition: objectCounter.h:31
Default on in debug, off in release.
Definition: objectCounter.h:27
Definition: featureGeometry.h:61
Config myConfig
Definition: areaFeature.h:89
DtFeatureSetTemplate< DtAreaFeature > DtAreaFeatureSet
Definition: areaFeature.h:41
virtual DetachCallback addDeleteCallback(const DeleteCallback &callback) const override
Add a user supplied callback to the feature to be called when the feature is deleted. If the feature is already deleted the callback may or may not be called by the implementation of this function. The callback is guaranteed to only be called once.
Definition: areaFeature.h:118
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:179
virtual boost::optional< Attribute > attribute(const Key &key) const override
Get attribute at a certain key.
Definition: areaFeature.h:116
virtual bool isDeleted() const override
Check to see if feature has been deleted. Note: this is not related to C++ delete or destructors...
Definition: areaFeature.h:123
boost::function< void(const Key &, const Attribute &)> ForEachFunction
Callback used to iterating through attributes with ForEachAttribute.
Definition: feature.h:150
Definition: areaFeature.h:43
Represents some coordinate system. The terms &quot;coordinate system&quot;, &quot;projection&quot;, &quot;spatial reference&quot;...
Definition: proj.h:52
Represents a set of characeters a DtFeature object can have. DtQuery objects are the way to communica...
Definition: query.h:37
boost::function< void()> DeleteCallback
User supplied callback called when feature is deleted.
Definition: feature.h:182
virtual DtFeatureGeometry geometry() const override
Get the geometry associated with this feature. GIS features each typically each associated with one g...
Definition: areaFeature.h:107
DtFeatureWrapper(const DtAreaFeature &f)
Definition: areaFeature.h:147
void setDeleted()
Definition: areaFeature.h:127
virtual void forEachAttribute(ForEachFunction func) const override
Calls the provided callback on each attribute.
Definition: areaFeature.h:109
std::shared_ptr< const DtAreaFeature > CPtr
Definition: areaFeature.h:33
virtual DtFeatureWrapper * clone() const override
Return a pointer to an object which represents the current feature. In order to enable paging and eff...
Definition: areaFeature.h:103
DtFeatureWrapper(const DtFeatureWrapper &from)
Copy constructor.
Definition: feature.h:387
std::shared_ptr< DtAreaFeature > Ptr
Definition: areaFeature.h:32
std::string type
Query type name.
Definition: areaFeature.h:50
DtLoadType
Used to indicate whether to load features. See DtFeatureSetTemplate::filter.
Definition: featureSet.h:33
virtual DtFeatureGeometry::Area area() const override
Get processed area.
Definition: areaFeature.h:105
DtFeatureWrapper(DtAreaFeature *f)
Definition: areaFeature.h:137
boost::optional< DtFeatureGeometry > myEnclosingGeometry
Definition: areaFeature.h:87
Represents a GIS feature. Features consist of a DtFeatureGeometry (2.5D geometric vector data) and a ...
Definition: feature.h:36
boost::function< void()> LoadedCallback
Callback type type for async notification of feature set loading.
Definition: featureSet.h:163
const std::unique_ptr< DtFeatureSet > myFeatureSet
Definition: areaFeature.h:86
Configuration object for processing areas.
Definition: areaFeature.h:47
Represents a feature geometry.
Definition: featureGeometry.h:40

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)