VR-Forces 5.0.2 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 boost::enable_shared_from_this<DtGdbVectorFeature>
28  {
29  public:
30 
31  typedef boost::shared_ptr<DtGdbVectorFeature> Ptr;
32 
34  DtGdbVectorFeature(boost::shared_ptr<DtSpecificationManager> mgr, DtProj::CPtr);
35 
37  virtual ~DtGdbVectorFeature();
38 
40  virtual DtFeatureGeometry geometry() const;
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*, boost::shared_ptr<DtSpecificationManager> mgr, DtProj::CPtr projection);
61 
63  static Ptr MakePath(const DtNetworkEdge*, boost::shared_ptr<DtSpecificationManager> mgr, DtProj::CPtr projection);
64 
66  static Ptr MakeArea(const DtNetworkEdge*, boost::shared_ptr<DtSpecificationManager> mgr, DtProj::CPtr projection);
67 
69  static Ptr Make(std::istream&, boost::shared_ptr<DtSpecificationManager> mgr, DtProj::CPtr projection);
70 
74  virtual boost::optional<Attribute> attribute(const Key & k) const;
75 
76  virtual void forEachAttribute(ForEachFunction f) const;
77 
78  virtual unsigned numberOfAttributes(const Key::String &) const;
79 
81  {
82  return DetachCallback();
83  }
84 
85  bool isDeleted() const
86  {
87  return false;
88  }
89 
91  virtual void print(std::ostream&);
92 
94  virtual void convert(DtProj::CPtr transformTo);
95 
96  protected:
97  virtual DtPoint geodeticTransform(const DtPoint&, DtProj::CPtr from, DtProj::CPtr to);
98 
99  protected:
100  boost::shared_ptr<DtFeatureGeometry> myGeometry;
101  boost::shared_ptr<DtSpecificationManager> mySpecificationManager;
104  };
105 
108  {
109  public:
111  DtGdbFeatureSetCollection(std::string file);
112 
115 
117  virtual ~DtGdbFeatureSetCollection();
118 
119  virtual std::string label() const;
120  DtFeatureSet* filter(
121  const DtQuery&, const boost::optional<DtFeatureGeometry>&, DtLoadType) const;
122  virtual void forEachFeatureParallel(const ForEachFunction&) const;
123  virtual DetachCallback forEachFeatureAsync(const ForEachFunction& func) const;
124  virtual DtFeatureSet* clone() const;
125  virtual bool loaded(double = 0.0) const;
126  virtual DetachCallback addLoadedCallback(const LoadedCallback&) const;
127  virtual unsigned numberOfFeatures() const;
128  virtual bool elided() const;
129  virtual bool empty() const;
130 
132  virtual void setFeatureType(DtFeatureGeometry::Type);
133 
135  virtual void add(DtGdbVectorFeature::Ptr);
136 
138  virtual void print(std::ostream&);
139 
140  protected:
141  std::vector<DtGdbVectorFeature::Ptr> myFeatures;
142  std::string myFile;
143  };
144 
148  {
149  public:
153  DtGdbVectorNetworkFeatureSet(DtVectorNetwork*, std::string file, const DtProj* transformToProjection = 0);
154 
157 
159  virtual ~DtGdbVectorNetworkFeatureSet();
160 
161  virtual std::string label() const;
162 
164  virtual DtGdbFeatureSetCollection* getOrCreatePointFeatureSet();
165 
167  virtual DtGdbFeatureSetCollection* getOrCreateLinearFeatureSet();
168 
170  virtual DtGdbFeatureSetCollection* getOrCreateArealFeatureSet();
171 
173  virtual void processNodeFeatures(DtVectorNetwork*);
174 
176  virtual void processEdgeFeatures(DtVectorNetwork*);
177 
179  virtual void addLinearFeature(DtNetworkEdge*);
180 
182  virtual void addArealFeature(DtNetworkEdge*);
183 
186  virtual bool isPointFeature(const DtNetworkElement& networkElement);
187 
190  virtual bool isLinearFeature(const DtNetworkElement& networkElement);
191 
194  virtual bool isArealFeature(const DtNetworkElement& networkElement);
195 
197  static DtGdbVectorNetworkFeatureSet* Make(const std::string&);
198 
201  virtual void print(const std::string& file);
202  virtual void print(std::ostream&);
203  virtual void print(std::ostream&, const DtSpecification&);
204  virtual void print(std::ostream&, DtGdbFeatureSetCollection*);
205 
209  virtual bool saveAsShapeFiles(const std::string& directory, std::string& error);
210 
211  protected:
212 
213  typedef std::map<std::string, int> AttributeMap;
214 
220  {
221  std::set<DtSpecificationID> ids;
223  };
224 
225  typedef std::map<int, SpecificationLayer> SpecificationLayers;
226 
229  virtual SpecificationLayers specificationLayers() const;
230 
232  virtual AttributeMap createAttributeMapFromSpecification(const DtSpecification&) const;
233 
235  virtual bool saveShapeFileForLayer(int featureType, const SpecificationLayer&, const std::string& directory, std::string& error) const;
236 
238  virtual std::string fixupNameToLength(const std::string& name, int length) const;
239 
241  virtual bool addAttributesToLayer(const AttributeMap&, OGRLayer*, std::string& error) const;
242 
244  virtual void addFeatureToOgrLayer(const DtFeature&, OGRLayer*, const SpecificationLayer&) const;
245 
246  protected:
250 
252  boost::shared_ptr<DtSpecificationManager> mySpecificationManager;
253 
256 
258  typedef std::map<std::string, std::string> OriginalLabelMap;
260  std::string myFile;
261  };
262 }
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
std::set< DtSpecificationID > ids
Definition: gdbVectorNetworkFeatureSet.h:221
std::map< std::string, int > AttributeMap
Definition: gdbVectorNetworkFeatureSet.h:213
DtSpecificationID mySpecID
Definition: gdbVectorNetworkFeatureSet.h:103
boost::function< void()> DetachCallback
Callback type for disconnecting other callbacks. Functions which register callbacks return a DetachCa...
Definition: featureSet.h:125
unsigned int DtSpecificationID
Definition: specificationManager.h:22
boost::shared_ptr< DtSpecificationManager > mySpecificationManager
Definition: gdbVectorNetworkFeatureSet.h:101
Represents a set of feature sets that represent a gdb vector network. This feature set will contain s...
Definition: gdbVectorNetworkFeatureSet.h:147
Feature subclasses that are ultimately used to inspect the specification manager for values...
Definition: gdbVectorNetworkFeatureSet.h:25
DtProj::CPtr myProjection
Definition: gdbVectorNetworkFeatureSet.h:102
boost::shared_ptr< DtGdbVectorFeature > Ptr
Definition: gdbVectorNetworkFeatureSet.h:31
boost::shared_ptr< DtFeatureGeometry > myGeometry
Definition: gdbVectorNetworkFeatureSet.h:100
std::vector< DtGdbVectorFeature::Ptr > myFeatures
Definition: gdbVectorNetworkFeatureSet.h:141
std::string myFile
Definition: gdbVectorNetworkFeatureSet.h:260
DtSpecificationID specificationID() const
Definition: gdbVectorNetworkFeatureSet.h:54
DtProj::CPtr myTransformToProjection
Definition: gdbVectorNetworkFeatureSet.h:255
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
DtGdbFeatureSetCollection * myPointFeatureSet
Definition: gdbVectorNetworkFeatureSet.h:247
Definition: networkNode.h:38
DtGdbFeatureSetCollection * myArealFeatureSet
Definition: gdbVectorNetworkFeatureSet.h:249
Represents some coordinate system. The terms &quot;coordinate system&quot;, &quot;projection&quot;, &quot;spatial reference&quot;...
Definition: proj.h:44
Represents a set of characeters a DtFeature object can have. DtQuery objects are the way to communica...
Definition: query.h:38
boost::function< void()> DeleteCallback
User supplied callback called when feature is deleted.
Definition: feature.h:183
AttributeMap attributes
Definition: gdbVectorNetworkFeatureSet.h:222
bool isDeleted() const
Check to see if feature has been deleted. Note: this is not related to C++ delete or destructors...
Definition: gdbVectorNetworkFeatureSet.h:85
std::string myFile
Definition: gdbVectorNetworkFeatureSet.h:142
boost::shared_ptr< const DtProj > CPtr
Definition: proj.h:48
Definition: specification.h:27
Represents a collection of DtGdbVectorFeatures.
Definition: gdbVectorNetworkFeatureSet.h:107
Definition: asyncJobServer.h:39
DtGdbFeatureSetCollection * myLinearFeatureSet
Definition: gdbVectorNetworkFeatureSet.h:248
DtProj::CPtr myProjection
Definition: gdbVectorNetworkFeatureSet.h:254
Definition: networkEdge.h:28
DtLoadType
Used to indicate whether to load features. See DtFeatureSetTemplate::filter.
Definition: featureSet.h:36
DetachCallback addDeleteCallback(const DeleteCallback &) const
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
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:37
boost::function< void()> LoadedCallback
Callback type type for async notification of feature set loading.
Definition: featureSet.h:156
std::map< int, SpecificationLayer > SpecificationLayers
Definition: gdbVectorNetworkFeatureSet.h:225
Organize by feature type. The attribute map will be the union of all attributes of that given feature...
Definition: gdbVectorNetworkFeatureSet.h:219
Definition: networkElement.h:38
Represents a feature geometry.
Definition: featureGeometry.h:39
Definition: point.h:34
OriginalLabelMap myOriginalLabelMap
Definition: gdbVectorNetworkFeatureSet.h:259
boost::shared_ptr< DtSpecificationManager > mySpecificationManager
Copy of the vector network specification manager.
Definition: gdbVectorNetworkFeatureSet.h:252
std::map< std::string, std::string > OriginalLabelMap
Original labels mapped to lowercase labels – for export.
Definition: gdbVectorNetworkFeatureSet.h:258
Definition: vectorNetwork.h:37
void print(double **a, int r, int c, char *str)

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)