VR-Forces 4.1 Class Documentation
ogrFeatureSet.h
Go to the documentation of this file.
1 
2 
3 
4 
5 #pragma once
6 
8 
9 #include <boost/scoped_ptr.hpp>
10 #include <boost/shared_ptr.hpp>
11 
12 #include <features/featureSet.h>
13 #include <features/feature.h>
14 #include <features/query.h>
15 
16 #include <ogrsf_frmts.h>
17 
18 namespace MAKVRinTerra
19 {
21  {
22  public:
23  typedef std::vector<DtFeatureGeometry> GeometryVector;
24 
25  static const char* LayerAttribute;
26 
27  DtOgrFeature(boost::shared_ptr<OGRFeature> feature, std::string layerName);
28  DtOgrFeature(boost::shared_ptr<OGRFeature> feature, std::string layerName, const DtProj&);
29 
30  unsigned numberOfAttributes(const Key::String &) const;
31 
32  boost::optional<Attribute> attribute(const Key & k) const;
33 
34  DtFeatureGeometry geometry() const;
35 
36  void forEachAttribute(ForEachFunction) const;
37 
38  private:
39  boost::shared_ptr<OGRFeature> myFeature;
41  std::string myLayerName;
42  };
43 
45  {
46  public:
47  typedef boost::shared_ptr<DtOgrDataSource> Ptr;
48 
51 
52  explicit DtOgrDataSource(std::string file,
53  std::string makLayerName = "");
54  explicit DtOgrDataSource(boost::shared_ptr<OGRDataSource> ds,
55  std::string makLayerName = "");
57 
58  void forEachFeature(ForEachFunction, DtWaitType) const;
59  DtFeatureSet* filter(const DtQuery &, DtLoadType) const;
60  DtFeatureSet* clone() const;
61  DtQuery schema() const;
62  bool loaded(double) const;
63 
64  //Static creator.
65  //If a DtOgrDataSource cannot be created, for example because the file
66  //does not exist, this function will return a DtFeatureSet::Empty instead.
69  static DtFeatureSet* Make(std::string file,
70  std::string makLayerName = "");
71 
72  private:
73  boost::shared_ptr<OGRDataSource> myDataSource;
74  std::string myMakLayerName;
75  };
76 
78  {
79  public:
81 
84  DtOgrLayer(boost::shared_ptr<OGRDataSource>, std::string layerName,
85  boost::optional<DtFeatureGeometry> filter = boost::optional<DtFeatureGeometry>(),
86  std::string makLayerName = "");
87 
88  void forEachFeature(ForEachFunction, DtWaitType) const;
89  DtFeatureSet* filter(const DtQuery &, DtLoadType) const;
90  DtFeatureSet* clone() const;
91  DtQuery schema() const;
92  bool loaded(double) const;
93 
94  private:
95  typedef std::set<DtFeature::Key> AttributeSet;
96 
97  boost::shared_ptr<OGRDataSource> myDataSource;
98  std::string myLayerName;
99  boost::shared_ptr<OGRLayer> myLayer;
101  boost::optional<DtFeatureGeometry> myGeometryFilter;
104  std::string myMakLayerName;
105  };
106 }

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)