9 #include <tbb/spin_mutex.h>
10 #include <tbb/spin_rw_mutex.h>
12 #include <boost/signals2.hpp>
13 #include <boost/foreach.hpp>
15 namespace MAKVRinTerra
27 typedef boost::shared_ptr<DtSimpleFeature>
Ptr;
28 typedef boost::shared_ptr<const DtSimpleFeature>
CPtr;
38 template <DtFeatureGeometry::Type T>
52 if (vec.size() <= k.
index)
53 vec.resize(k.
index + 1);
64 AttributeVectorMap::const_iterator set = myAttributeVectorMap.find(name);
65 if (set != myAttributeVectorMap.end())
66 return set->second.size();
73 AttributeVectorMap::const_iterator set = myAttributeVectorMap.find(k.
name);
74 if (set != myAttributeVectorMap.end())
75 if (k.
index < set->second.size())
76 return set->second[k.
index];
78 return boost::optional<Attribute>();
83 typedef AttributeVectorMap::const_iterator MapIterator;
85 for (MapIterator set=myAttributeVectorMap.begin(); set != myAttributeVectorMap.end(); ++set)
86 for (
unsigned setIndex=0; setIndex < set->second.size(); ++setIndex)
87 f(
Key(set->first, setIndex), set->second[setIndex]);
108 template <
typename F = DtFeature>
124 Mutex::scoped_lock lock(
mutex);
130 Mutex::scoped_lock lock(
mutex);
144 Mutex::scoped_lock lock(
mutex);
151 signal.disconnect_all_slots();
158 typedef boost::signals2::signal_type<
160 boost::signals2::keywords::mutex_type<tbb::spin_mutex> >::type
Signal;
DetachCallback addDeleteCallback(const DeleteCallback &) const
Add a user supplied callback to the feature to be called when the feature is deleted.
Definition: simpleFeature.h:90
#define DT_DLL_features
stop complaining about multiple independent base classes for boost::noncopyable this should probably ...
Definition: featuresDefines.h:36
boost::signals2::connection Connection
Definition: simpleFeature.h:162
DetachCallback addDeleteCallback(const DeleteCallback &callback) const
Definition: simpleFeature.h:128
boost::optional< Attribute > attribute(const Key &k) const
Get attribute at a certain key.
Definition: simpleFeature.h:71
Key used to lookup attributes.
Definition: feature.h:66
std::map< DtFeature::Key::String, AttributeVector > AttributeVectorMap
Definition: simpleFeature.h:102
DtFeatureGeometry geometry() const
Get the geometry associated with this feature.
Definition: simpleFeature.h:57
DtSimpleFeature(const DtFeatureGeometry &geom)
Definition: simpleFeature.h:34
#define DT_DEFINE_OBJECT_DEBUGGER_NAME(type)
Definition: objectCounter.h:265
Default on in debug, off in release.
Definition: objectCounter.h:31
Definition: featureGeometry.h:54
DtDeletableFeature(bool deleted=false)
Definition: simpleFeature.h:117
DtSimpleFeature(const typename DtFeatureGeometry::Handle< T > &h)
Definition: simpleFeature.h:39
boost::signals2::signal_type< void(), boost::signals2::keywords::mutex_type< tbb::spin_mutex > >::type Signal
Definition: simpleFeature.h:160
Basic implementation of DtFeature interface.
Definition: simpleFeature.h:22
boost::function< void()> DetachCallback
Callback used to detach the user from a feature so the users callback is not called anymore...
Definition: feature.h:178
DtSimpleFeature()
Definition: simpleFeature.h:30
boost::shared_ptr< const DtSimpleFeature > CPtr
Definition: simpleFeature.h:28
bool isDeleted() const
Check to see if feature has been deleted.
Definition: simpleFeature.h:95
String name
Definition: feature.h:99
unsigned index
Definition: feature.h:100
DtSimpleFeature(const DtFeature &f)
Definition: simpleFeature.h:44
boost::function< void(const Key &, const Attribute &)> ForEachFunction
Callback used to iterating through attributes with ForEachAttribute.
Definition: feature.h:149
Mutex mutex
Definition: simpleFeature.h:164
F::DeleteCallback DeleteCallback
Definition: simpleFeature.h:115
binderNoArgs< _Fn > bind(const _Fn &_Func, const _Ty &_Left)
Definition: DtSTLUtilities.h:76
boost::function< void()> DeleteCallback
User supplied callback called when feature is deleted.
Definition: feature.h:181
void forEachAttribute(ForEachFunction f) const
Calls the provided callback on each attribute.
Definition: simpleFeature.h:81
void setDeleted()
Definition: simpleFeature.h:142
F::DetachCallback DetachCallback
Definition: simpleFeature.h:114
#define DT_DEFINE_OBJECT_DEBUGGER_NAME_TEMPLATE(type)
Definition: objectCounter.h:275
AttributeVectorMap myAttributeVectorMap
Definition: simpleFeature.h:104
Definition: simpleFeature.h:109
virtual void forEachAttribute(ForEachFunction f) const
Calls the provided callback on each attribute.
Definition: feature.h:155
Signal signal
Definition: simpleFeature.h:165
unsigned numberOfAttributes(const Key::String &name) const
Definition: simpleFeature.h:62
tbb::spin_mutex Mutex
Definition: simpleFeature.h:156
bool isDeleted() const
Definition: simpleFeature.h:122
Represents a GIS feature.
Definition: feature.h:37
bool deleted
Definition: simpleFeature.h:166
std::vector< Attribute > AttributeVector
Definition: simpleFeature.h:101
boost::shared_ptr< DtSimpleFeature > Ptr
Definition: simpleFeature.h:27
void addAttribute(const Key &k, Attribute attr)
Definition: simpleFeature.h:49
DtFeatureGeometry myGeometry
Definition: simpleFeature.h:105
Represents a feature geometry.
Definition: featureGeometry.h:35
boost::variant< std::string, long long, bool, double > Attribute
boost::variant type for accessing attributes.
Definition: feature.h:46