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
24 #ifdef DtObjectDebugger_Enable
29 typedef boost::shared_ptr<DtSimpleFeature>
Ptr;
30 typedef boost::shared_ptr<const DtSimpleFeature>
CPtr;
40 template <DtFeatureGeometry::Type T>
54 if (vec.size() <= k.
index)
55 vec.resize(k.
index + 1);
66 AttributeVectorMap::const_iterator set = myAttributeVectorMap.find(name);
67 if (set != myAttributeVectorMap.end())
68 return set->second.size();
75 AttributeVectorMap::const_iterator set = myAttributeVectorMap.find(k.
name);
76 if (set != myAttributeVectorMap.end())
77 if (k.
index < set->second.size())
78 return set->second[k.
index];
80 return boost::optional<Attribute>();
85 typedef AttributeVectorMap::const_iterator MapIterator;
87 for (MapIterator set=myAttributeVectorMap.begin(); set != myAttributeVectorMap.end(); ++set)
88 for (
unsigned setIndex=0; setIndex < set->second.size(); ++setIndex)
89 f(
Key(set->first, setIndex), set->second[setIndex]);
110 template <
typename F = DtFeature>
113 #ifdef DtObjectDebugger_Enable
128 Mutex::scoped_lock lock(
mutex);
134 Mutex::scoped_lock lock(
mutex);
148 Mutex::scoped_lock lock(
mutex);
155 signal.disconnect_all_slots();
162 typedef boost::signals2::signal_type<
164 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:92
#define DT_DLL_features
stop complaining about multiple independent base classes for boost::noncopyable this should probably ...
Definition: featuresDefines.h:41
boost::signals2::connection Connection
Definition: simpleFeature.h:166
DetachCallback addDeleteCallback(const DeleteCallback &callback) const
Definition: simpleFeature.h:132
boost::optional< Attribute > attribute(const Key &k) const
Get attribute at a certain key.
Definition: simpleFeature.h:73
Key used to lookup attributes.
Definition: feature.h:68
std::map< DtFeature::Key::String, AttributeVector > AttributeVectorMap
Definition: simpleFeature.h:104
DtFeatureGeometry geometry() const
Get the geometry associated with this feature.
Definition: simpleFeature.h:59
DtSimpleFeature(const DtFeatureGeometry &geom)
Definition: simpleFeature.h:36
#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:56
DtDeletableFeature(bool deleted=false)
Definition: simpleFeature.h:121
DtSimpleFeature(const typename DtFeatureGeometry::Handle< T > &h)
Definition: simpleFeature.h:41
boost::signals2::signal_type< void(), boost::signals2::keywords::mutex_type< tbb::spin_mutex > >::type Signal
Definition: simpleFeature.h:164
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:180
DtSimpleFeature()
Definition: simpleFeature.h:32
boost::shared_ptr< const DtSimpleFeature > CPtr
Definition: simpleFeature.h:30
bool isDeleted() const
Check to see if feature has been deleted.
Definition: simpleFeature.h:97
String name
Definition: feature.h:101
unsigned index
Definition: feature.h:102
DtSimpleFeature(const DtFeature &f)
Definition: simpleFeature.h:46
boost::function< void(const Key &, const Attribute &)> ForEachFunction
Callback used to iterating through attributes with ForEachAttribute.
Definition: feature.h:151
Mutex mutex
Definition: simpleFeature.h:168
F::DeleteCallback DeleteCallback
Definition: simpleFeature.h:119
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:183
void forEachAttribute(ForEachFunction f) const
Calls the provided callback on each attribute.
Definition: simpleFeature.h:83
void setDeleted()
Definition: simpleFeature.h:146
F::DetachCallback DetachCallback
Definition: simpleFeature.h:118
#define DT_DEFINE_OBJECT_DEBUGGER_NAME_TEMPLATE(type)
Definition: objectCounter.h:275
AttributeVectorMap myAttributeVectorMap
Definition: simpleFeature.h:106
Definition: simpleFeature.h:111
virtual void forEachAttribute(ForEachFunction f) const
Calls the provided callback on each attribute.
Definition: feature.h:157
Signal signal
Definition: simpleFeature.h:169
unsigned numberOfAttributes(const Key::String &name) const
Definition: simpleFeature.h:64
tbb::spin_mutex Mutex
Definition: simpleFeature.h:160
bool isDeleted() const
Definition: simpleFeature.h:126
Represents a GIS feature.
Definition: feature.h:37
bool deleted
Definition: simpleFeature.h:170
std::vector< Attribute > AttributeVector
Definition: simpleFeature.h:103
boost::shared_ptr< DtSimpleFeature > Ptr
Definition: simpleFeature.h:29
void addAttribute(const Key &k, Attribute attr)
Definition: simpleFeature.h:51
DtFeatureGeometry myGeometry
Definition: simpleFeature.h:107
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:48