9 #include <tbb/spin_mutex.h>
10 #include <tbb/spin_rw_mutex.h>
12 #include <boost/signals2.hpp>
14 namespace MAKVRinTerra
23 #ifdef DtObjectDebugger_Enable
28 typedef std::shared_ptr<DtSimpleFeature>
Ptr;
29 typedef std::shared_ptr<const DtSimpleFeature>
CPtr;
39 template <DtFeatureGeometry::Type T>
53 if (vec.size() <= k.
index)
55 vec.resize(k.
index + 1);
64 AttributeVectorMap::const_iterator set = myAttributeVectorMap.find(name);
65 if (set != myAttributeVectorMap.end())
67 return set->second.size();
73 virtual boost::optional<Attribute>
attribute(
const Key& k)
const override
75 AttributeVectorMap::const_iterator set = myAttributeVectorMap.find(k.
name);
76 if (set != myAttributeVectorMap.end())
78 if (k.
index < set->second.size())
80 return set->second[k.
index];
84 return boost::optional<Attribute>();
89 typedef AttributeVectorMap::const_iterator MapIterator;
91 for (MapIterator set = myAttributeVectorMap.begin(); set != myAttributeVectorMap.end(); ++set)
93 for (
unsigned setIndex = 0; setIndex < set->second.size(); ++setIndex)
95 f(
Key(set->first, setIndex), set->second[setIndex]);
114 template <
typename F = DtFeature>
117 #ifdef DtObjectDebugger_Enable
132 Mutex::scoped_lock lock(
mutex);
138 Mutex::scoped_lock lock(
mutex);
147 return boost::bind(&Connection::disconnect, conn);
152 Mutex::scoped_lock lock(
mutex);
159 signal.disconnect_all_slots();
166 typedef boost::signals2::signal_type<
168 boost::signals2::keywords::mutex_type<tbb::spin_mutex> >::type
Signal;
#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:170
DetachCallback addDeleteCallback(const DeleteCallback &callback) const
Definition: simpleFeature.h:136
Key used to lookup attributes. The DtFeature interface is a dictionary that maps Key objects to attri...
Definition: feature.h:67
virtual bool isDeleted() const override
Check to see if feature has been deleted. Note: this is not related to C++ delete or destructors...
Definition: simpleFeature.h:102
std::shared_ptr< const DtSimpleFeature > CPtr
Definition: simpleFeature.h:29
std::map< DtFeature::Key::String, AttributeVector > AttributeVectorMap
Definition: simpleFeature.h:108
DtSimpleFeature(const DtFeatureGeometry &geom)
Definition: simpleFeature.h:35
#define DT_DEFINE_OBJECT_DEBUGGER_NAME(type)
Definition: objectCounter.h:31
Default on in debug, off in release.
Definition: objectCounter.h:27
Definition: featureGeometry.h:61
DtDeletableFeature(bool deleted=false)
Definition: simpleFeature.h:125
DtSimpleFeature(const typename DtFeatureGeometry::Handle< T > &h)
Definition: simpleFeature.h:40
boost::signals2::signal_type< void(), boost::signals2::keywords::mutex_type< tbb::spin_mutex > >::type Signal
Definition: simpleFeature.h:168
Basic implementation of DtFeature interface.
Definition: simpleFeature.h:21
boost::function< void()> DetachCallback
Callback used to detach the user from a feature so the users callback is not called anymore...
Definition: feature.h:179
DtSimpleFeature()
Definition: simpleFeature.h:31
String name
Definition: feature.h:100
unsigned index
Definition: feature.h:101
DtSimpleFeature(const DtFeature &f)
Definition: simpleFeature.h:45
boost::function< void(const Key &, const Attribute &)> ForEachFunction
Callback used to iterating through attributes with ForEachAttribute.
Definition: feature.h:150
virtual DtFeatureGeometry geometry() const override
Get the geometry associated with this feature. GIS features each typically each associated with one g...
Definition: simpleFeature.h:60
Mutex mutex
Definition: simpleFeature.h:172
virtual unsigned numberOfAttributes(const Key::String &name) const override
Definition: simpleFeature.h:62
F::DeleteCallback DeleteCallback
Definition: simpleFeature.h:123
boost::function< void()> DeleteCallback
User supplied callback called when feature is deleted.
Definition: feature.h:182
void setDeleted()
Definition: simpleFeature.h:150
F::DetachCallback DetachCallback
Definition: simpleFeature.h:122
#define DT_DEFINE_OBJECT_DEBUGGER_NAME_TEMPLATE(type)
Definition: objectCounter.h:32
AttributeVectorMap myAttributeVectorMap
Definition: simpleFeature.h:110
Definition: simpleFeature.h:115
virtual void forEachAttribute(ForEachFunction f) const
Calls the provided callback on each attribute.
Definition: feature.h:156
Signal signal
Definition: simpleFeature.h:173
virtual DetachCallback addDeleteCallback(const DeleteCallback &) const override
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: simpleFeature.h:100
virtual boost::optional< Attribute > attribute(const Key &k) const override
Get attribute at a certain key.
Definition: simpleFeature.h:73
tbb::spin_mutex Mutex
Definition: simpleFeature.h:164
bool isDeleted() const
Definition: simpleFeature.h:130
Represents a GIS feature. Features consist of a DtFeatureGeometry (2.5D geometric vector data) and a ...
Definition: feature.h:36
bool deleted
Definition: simpleFeature.h:174
std::vector< Attribute > AttributeVector
Definition: simpleFeature.h:107
void addAttribute(const Key &k, Attribute attr)
Definition: simpleFeature.h:50
DtFeatureGeometry myGeometry
Definition: simpleFeature.h:111
Represents a feature geometry.
Definition: featureGeometry.h:40
std::shared_ptr< DtSimpleFeature > Ptr
Definition: simpleFeature.h:28
boost::variant< std::string, long long, bool, double > Attribute
boost::variant type for accessing attributes.
Definition: feature.h:47
virtual void forEachAttribute(ForEachFunction f) const override
Calls the provided callback on each attribute.
Definition: simpleFeature.h:87