VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ogrFeatureSet.h
Go to the documentation of this file.
1 
5 #pragma once
6 
9 
10 #include <boost/scoped_ptr.hpp>
11 #include <boost/shared_ptr.hpp>
12 
13 #include <features/featureSet.h>
14 #include <features/feature.h>
15 #include <features/query.h>
16 
18 
19 #include <tbb/spin_rw_mutex.h>
20 
21 #include <gdal.h>
22 #include <set>
23 
24 class OGRFeature;
25 class GDALDataset;
26 
27 namespace MAKVRinTerra
28 {
30  {
31  public:
32  typedef std::vector<DtFeatureGeometry> GeometryVector;
33 
35  boost::shared_ptr<OGRFeature> feature,
36  DtFeatureGeometry geometry,
37  DtFeature::CPtr defaults);
38 
39  unsigned numberOfAttributes(const Key::String &) const;
40 
41  boost::optional<Attribute> attribute(const Key & k) const;
42 
43  DtFeatureGeometry geometry() const;
44 
45  void forEachAttribute(ForEachFunction) const;
46 
48  {
49  return DetachCallback();
50  }
51 
52  bool isDeleted() const
53  {
54  return false;
55  }
56 
57  private:
58  boost::shared_ptr<OGRFeature> myFeature;
61  };
62 
64  {
65  public:
66  typedef boost::shared_ptr<DtOgrDataSource> Ptr;
67  typedef boost::shared_ptr<GDALDataset> GDALPtr;
68 
72  static DtFeatureSet* Make(std::string file, std::string layerName = "");
73 
75  explicit DtOgrDataSource(std::string file, std::string layerName = "");
76 
77  std::string label() const;
78  bool isIndexed() const;
79 
80  protected:
81  std::string myFile;
83  };
84 
86  {
87  public:
89  typedef boost::shared_ptr<GDALDataset> GDALPtr;
90 
91  DtOgrLayer(
92  const std::string& path,
93  int layerNum,
94  bool indexed,
95  const std::string& srcPath,
96  const std::string& configLayerName = "");
97 
98  std::string label() const;
99  void forEachFeatureParallel(const ForEachFunction&) const;
100  DetachCallback forEachFeatureAsync(const ForEachFunction&) const;
101  DtFeatureSet* filter(
102  const DtQuery& query,
103  const boost::optional<DtFeatureGeometry>&,
104  DtLoadType) const;
105  DtFeatureSet* clone() const;
106  bool loaded(double) const;
107  DetachCallback addLoadedCallback(const LoadedCallback&) const;
108  bool elided() const;
109  bool empty() const;
110  bool isIndexed() const;
111 
112  protected:
114  {
115  public:
116  GDALDataSource(const std::string&);
117 
119  GDALPtr getDataSource() const;
120 
121  protected:
122  mutable tbb::spin_rw_mutex myThreadedGDALDataSetsMutex;
123  typedef std::map<unsigned int, GDALPtr> ThreadedGDALDataSets;
125 
126  std::string myDatasetFile;
127  };
128 
129  protected:
130  explicit DtOgrLayer(const DtOgrLayer& from);
131  DtOgrLayer(const DtOgrLayer& from, boost::optional<DtFeatureGeometry> filter);
132 
133  typedef std::set<DtFeature::Key> AttributeSet;
134 
135  std::string myDatasetFile;
137  boost::optional<DtFeatureGeometry> myGeometryFilter;
140  std::string myLayerName;
141  std::string myConfigLayerName;
144  std::string myLabel;
145 
146  boost::shared_ptr<GDALDataSource> myGDALDataSource;
147  };
148 }
Represents a set of DtFeature objects or others which conform to the DtFeature concept.
Definition: featureSet.h:101
boost::shared_ptr< DtOgrDataSource > Ptr
Definition: ogrFeatureSet.h:66
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
tbb::spin_rw_mutex myThreadedGDALDataSetsMutex
Definition: ogrFeatureSet.h:122
boost::shared_ptr< GDALDataSource > myGDALDataSource
Definition: ogrFeatureSet.h:146
DtProj::CPtr myGeometryProjection
Definition: ogrFeatureSet.h:136
boost::function< void()> DetachCallback
Callback type for disconnecting other callbacks. Functions which register callbacks return a DetachCa...
Definition: featureSet.h:125
Definition: ogrFeatureSet.h:63
std::string myDatasetFile
Definition: ogrFeatureSet.h:126
Key used to lookup attributes. The DtFeature interface is a dictionary that maps Key objects to attri...
Definition: feature.h:68
std::vector< DtFeatureGeometry > GeometryVector
Definition: ogrFeatureSet.h:32
std::map< unsigned int, GDALPtr > ThreadedGDALDataSets
Definition: ogrFeatureSet.h:123
boost::shared_ptr< GDALDataset > GDALPtr
Definition: ogrFeatureSet.h:89
boost::shared_ptr< const DtFeature > CPtr
Definition: feature.h:46
boost::shared_ptr< OGRFeature > myFeature
Definition: ogrFeatureSet.h:58
Definition: ogrFeatureSet.h:113
Definition: ogrFeatureSet.h:29
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
Definition: ogrFeatureSet.h:85
boost::function< void(const Key &, const Attribute &)> ForEachFunction
Callback used to iterating through attributes with ForEachAttribute.
Definition: feature.h:151
Represents a set of characeters a DtFeature object can have. DtQuery objects are the way to communica...
Definition: query.h:38
bool isDeleted() const
Check to see if feature has been deleted. Note: this is not related to C++ delete or destructors...
Definition: ogrFeatureSet.h:52
boost::function< void()> DeleteCallback
User supplied callback called when feature is deleted.
Definition: feature.h:183
boost::shared_ptr< GDALDataset > GDALPtr
Definition: ogrFeatureSet.h:67
DtFeatureGeometry myGeometry
Definition: ogrFeatureSet.h:59
boost::shared_ptr< const DtProj > CPtr
Definition: proj.h:48
boost::optional< DtFeatureGeometry > myGeometryFilter
Definition: ogrFeatureSet.h:137
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: ogrFeatureSet.h:47
Create a new MAK exception type that inherits from boost::exception. Tag is what differentiates this ...
Definition: taggedException.h:15
std::set< DtFeature::Key > AttributeSet
Definition: ogrFeatureSet.h:133
std::string myLayerName
Definition: ogrFeatureSet.h:140
std::string myConfigLayerName
Definition: ogrFeatureSet.h:141
DtLoadType
Used to indicate whether to load features. See DtFeatureSetTemplate::filter.
Definition: featureSet.h:36
DtFeature::CPtr myDefaults
Definition: ogrFeatureSet.h:60
std::string myFile
Definition: ogrFeatureSet.h:81
std::string myDatasetFile
Definition: ogrFeatureSet.h:135
DtFeature::CPtr myDefaults
Definition: ogrFeatureSet.h:142
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
ThreadedGDALDataSets myThreadedGDALDataSets
Definition: ogrFeatureSet.h:124
boost::function< void()> LoadedCallback
Callback type type for async notification of feature set loading.
Definition: featureSet.h:156
bool myIndexedFlag
Definition: ogrFeatureSet.h:143
std::string myLabel
Definition: ogrFeatureSet.h:144
Represents a feature geometry.
Definition: featureGeometry.h:39
int myLayerNumber
Definition: ogrFeatureSet.h:139
DtTaggedException< DtOgrLayer > Exception
Definition: ogrFeatureSet.h:88
GDALPtr myDataSource
Definition: ogrFeatureSet.h:82
AttributeSet myAttributes
Definition: ogrFeatureSet.h:138

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)