VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
gdbVectorNetworkFeatureSet.h
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include <features/featureSet.h>
9 #include <features/feature.h>
10 #include <features/query.h>
12 #include <iosfwd>
13 #include <set>
14 
15 class DtVectorNetwork;
16 class DtNetworkEdge;
17 class DtNetworkNode;
18 class DtNetworkElement;
19 class OGRLayer;
20 
21 namespace MAKVRinTerra
22 {
26  : public DtFeature
27  , public std::enable_shared_from_this<DtGdbVectorFeature>
28  {
29  public:
30 
31  typedef std::shared_ptr<DtGdbVectorFeature> Ptr;
32 
34  DtGdbVectorFeature(std::shared_ptr<DtSpecificationManager> mgr, DtProj::CPtr);
35 
37  virtual ~DtGdbVectorFeature() override;
38 
40  virtual DtFeatureGeometry geometry() const override;
41 
43  virtual void setAsPointGeometry(const DtPoint&);
44 
46  virtual void setAsLinearGeometry(const std::vector<DtPoint>&);
47 
49  virtual void setAsArealGeometry(const std::vector<DtPoint>&);
50 
53  virtual void setSpecificationID(DtSpecificationID);
55  {
56  return mySpecID;
57  }
58 
60  static Ptr MakePoint(const DtNetworkNode*, std::shared_ptr<DtSpecificationManager> mgr, DtProj::CPtr projection);
61 
63  static Ptr MakePath(const DtNetworkEdge*, std::shared_ptr<DtSpecificationManager> mgr, DtProj::CPtr projection);
64 
66  static Ptr MakeArea(const DtNetworkEdge*, std::shared_ptr<DtSpecificationManager> mgr, DtProj::CPtr projection);
67 
69  static Ptr Make(std::istream&, std::shared_ptr<DtSpecificationManager> mgr, DtProj::CPtr projection);
70 
74  virtual boost::optional<Attribute> attribute(const Key& k) const override;
75 
76  virtual void forEachAttribute(ForEachFunction f) const override;
77 
78  virtual unsigned numberOfAttributes(const Key::String&) const override;
79 
80  virtual DetachCallback addDeleteCallback(const DeleteCallback&) const override { return DetachCallback(); }
81 
82  virtual bool isDeleted() const override {
83  return false;
84  }
85 
87  virtual void print(std::ostream&);
88 
90  virtual void convert(DtProj::CPtr transformTo);
91 
92  protected:
93  virtual DtPoint geodeticTransform(const DtPoint&, DtProj::CPtr from, DtProj::CPtr to);
94 
95  protected:
96  std::shared_ptr<DtFeatureGeometry> myGeometry;
97  std::shared_ptr<DtSpecificationManager> mySpecificationManager;
100  };
101 
104  {
105  public:
107  DtGdbFeatureSetCollection(std::string file);
108 
111 
113  virtual ~DtGdbFeatureSetCollection() override;
114 
115  virtual std::string label() const override;
116  virtual DtFeatureSet* filter(
117  const DtQuery&, const boost::optional<DtFeatureGeometry>&, DtLoadType) const override;
118  virtual void forEachFeatureParallel(const ForEachFunction&) const override;
119  virtual DetachCallback forEachFeatureAsync(const ForEachFunction& func) const override;
120  virtual DtFeatureSet* clone() const override;
121  virtual bool loaded(double = 0.0) const override;
122  virtual DetachCallback addLoadedCallback(const LoadedCallback&) const override;
123  virtual unsigned numberOfFeatures() const override;
124  virtual bool elided() const override;
125  virtual bool empty() const override;
126 
128  virtual void setFeatureType(DtFeatureGeometry::Type);
129 
131  virtual void add(DtGdbVectorFeature::Ptr);
132 
134  virtual void print(std::ostream&);
135 
136  protected:
137  std::vector<DtGdbVectorFeature::Ptr> myFeatures;
138  std::string myFile;
139  };
140 
144  {
145  public:
149  DtGdbVectorNetworkFeatureSet(DtVectorNetwork*, std::string file, const DtProj* transformToProjection = 0);
150 
153 
155  virtual ~DtGdbVectorNetworkFeatureSet() override;
156 
157  virtual std::string label() const override;
158 
160  virtual DtGdbFeatureSetCollection* getOrCreatePointFeatureSet();
161 
163  virtual DtGdbFeatureSetCollection* getOrCreateLinearFeatureSet();
164 
166  virtual DtGdbFeatureSetCollection* getOrCreateArealFeatureSet();
167 
169  virtual void processNodeFeatures(DtVectorNetwork*);
170 
172  virtual void processEdgeFeatures(DtVectorNetwork*);
173 
175  virtual void addLinearFeature(DtNetworkEdge*);
176 
178  virtual void addArealFeature(DtNetworkEdge*);
179 
182  virtual bool isPointFeature(const DtNetworkElement& networkElement);
183 
186  virtual bool isLinearFeature(const DtNetworkElement& networkElement);
187 
190  virtual bool isArealFeature(const DtNetworkElement& networkElement);
191 
193  static DtGdbVectorNetworkFeatureSet* Make(const std::string&);
194 
197  virtual void print(const std::string& file);
198  virtual void print(std::ostream&);
199  virtual void print(std::ostream&, const DtSpecification&);
200  virtual void print(std::ostream&, DtGdbFeatureSetCollection*);
201 
205  virtual bool saveAsShapeFiles(const std::string& directory, std::string& error);
206 
207  protected:
208 
209  typedef std::map<std::string, int> AttributeMap;
210 
216  {
217  std::set<DtSpecificationID> ids;
219  };
220 
221  typedef std::map<int, SpecificationLayer> SpecificationLayers;
222 
225  virtual SpecificationLayers specificationLayers() const;
226 
228  virtual AttributeMap createAttributeMapFromSpecification(const DtSpecification&) const;
229 
231  virtual bool saveShapeFileForLayer(int featureType, const SpecificationLayer&, const std::string& directory, std::string& error) const;
232 
234  virtual std::string fixupNameToLength(const std::string& name, int length) const;
235 
237  virtual bool addAttributesToLayer(const AttributeMap&, OGRLayer*, std::string& error) const;
238 
240  virtual void addFeatureToOgrLayer(const DtFeature&, OGRLayer*, const SpecificationLayer&) const;
241 
242  protected:
246 
248  std::shared_ptr<DtSpecificationManager> mySpecificationManager;
249 
252 
254  typedef std::map<std::string, std::string> OriginalLabelMap;
256  std::string myFile;
257  };
258 }
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
std::set< DtSpecificationID > ids
Definition: gdbVectorNetworkFeatureSet.h:217
std::map< std::string, int > AttributeMap
Definition: gdbVectorNetworkFeatureSet.h:209
DtSpecificationID mySpecID
Definition: gdbVectorNetworkFeatureSet.h:99
boost::function< void()> DetachCallback
Callback type for disconnecting other callbacks. Functions which register callbacks return a DetachCa...
Definition: featureSet.h:132
unsigned int DtSpecificationID
Definition: specificationManager.h:22
std::shared_ptr< const DtProj > CPtr
Definition: proj.h:56
Represents a set of feature sets that represent a gdb vector network. This feature set will contain s...
Definition: gdbVectorNetworkFeatureSet.h:143
std::shared_ptr< DtSpecificationManager > mySpecificationManager
Copy of the vector network specification manager.
Definition: gdbVectorNetworkFeatureSet.h:248
Feature subclasses that are ultimately used to inspect the specification manager for values...
Definition: gdbVectorNetworkFeatureSet.h:25
DtProj::CPtr myProjection
Definition: gdbVectorNetworkFeatureSet.h:98
virtual DetachCallback addDeleteCallback(const DeleteCallback &) 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: gdbVectorNetworkFeatureSet.h:80
std::vector< DtGdbVectorFeature::Ptr > myFeatures
Definition: gdbVectorNetworkFeatureSet.h:137
std::string myFile
Definition: gdbVectorNetworkFeatureSet.h:256
DtSpecificationID specificationID() const
Definition: gdbVectorNetworkFeatureSet.h:54
DtProj::CPtr myTransformToProjection
Definition: gdbVectorNetworkFeatureSet.h:251
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
DtGdbFeatureSetCollection * myPointFeatureSet
Definition: gdbVectorNetworkFeatureSet.h:243
void print(double **a, int r, int c, const char *str)
Definition: networkNode.h:38
std::shared_ptr< DtFeatureGeometry > myGeometry
Definition: gdbVectorNetworkFeatureSet.h:96
DtGdbFeatureSetCollection * myArealFeatureSet
Definition: gdbVectorNetworkFeatureSet.h:245
std::shared_ptr< DtSpecificationManager > mySpecificationManager
Definition: gdbVectorNetworkFeatureSet.h:97
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
AttributeMap attributes
Definition: gdbVectorNetworkFeatureSet.h:218
std::string myFile
Definition: gdbVectorNetworkFeatureSet.h:138
std::shared_ptr< DtGdbVectorFeature > Ptr
Definition: gdbVectorNetworkFeatureSet.h:31
Definition: specification.h:27
Represents a collection of DtGdbVectorFeatures.
Definition: gdbVectorNetworkFeatureSet.h:103
Definition: asyncJobServer.h:39
DtGdbFeatureSetCollection * myLinearFeatureSet
Definition: gdbVectorNetworkFeatureSet.h:244
DtProj::CPtr myProjection
Definition: gdbVectorNetworkFeatureSet.h:250
Definition: networkEdge.h:28
DtLoadType
Used to indicate whether to load features. See DtFeatureSetTemplate::filter.
Definition: featureSet.h:33
virtual bool isDeleted() const override
Check to see if feature has been deleted. Note: this is not related to C++ delete or destructors...
Definition: gdbVectorNetworkFeatureSet.h:82
DT_DLL_VRVCORE double length(const makVrv::DtCoordinateSystem &, const std::vector< DtVector > &vertices)
Returns the total distance of a segmented line defined by the provided vector of vertices. Coordinates are in local database coordinates. The coordinate system is used to convert between the local database coordinates and geocentric. All distance is in 2D – the Z value is ignored.
DtFeatureSet used to combine multiple feature sets into one. This class allows all feature set algori...
Definition: featureSetList.h:26
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
std::map< int, SpecificationLayer > SpecificationLayers
Definition: gdbVectorNetworkFeatureSet.h:221
Organize by feature type. The attribute map will be the union of all attributes of that given feature...
Definition: gdbVectorNetworkFeatureSet.h:215
Definition: networkElement.h:38
Represents a feature geometry.
Definition: featureGeometry.h:40
Definition: point.h:34
OriginalLabelMap myOriginalLabelMap
Definition: gdbVectorNetworkFeatureSet.h:255
std::map< std::string, std::string > OriginalLabelMap
Original labels mapped to lowercase labels – for export.
Definition: gdbVectorNetworkFeatureSet.h:254
Definition: vectorNetwork.h:37

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)