VR-Forces 4.2 Class Documentation
simpleFeature.h
Go to the documentation of this file.
1 
2 
3 
4 
5 #pragma once
6 
7 #include <features/feature.h>
8 
9 namespace MAKVRinTerra
10 {
16  class DtSimpleFeature : public DtFeature
17  {
18  public:
19  typedef boost::shared_ptr<DtSimpleFeature> Ptr;
20  typedef boost::shared_ptr<const DtSimpleFeature> CPtr;
21 
23  {
24  }
25 
27  {
28  f.forEachAttribute(boost::bind(&DtSimpleFeature::addAttribute, this, _1, _2));
29  }
30 
32  {
33  return myGeometry;
34  }
35 
36  unsigned numberOfAttributes(const Key::String & name) const
37  {
38  AttributeVectorMap::const_iterator set = myAttributeVectorMap.find(name);
39  if (set != myAttributeVectorMap.end())
40  return set->second.size();
41 
42  return 0;
43  }
44 
45  boost::optional<Attribute> attribute(const Key & k) const
46  {
47  AttributeVectorMap::const_iterator set = myAttributeVectorMap.find(k.name);
48  if (set != myAttributeVectorMap.end())
49  if (k.index < set->second.size())
50  return set->second[k.index];
51 
52  return boost::optional<Attribute>();
53  }
54 
56  {
57  typedef AttributeVectorMap::const_iterator MapIterator;
58 
59  for (MapIterator set=myAttributeVectorMap.begin(); set != myAttributeVectorMap.end(); ++set)
60  for (unsigned setIndex=0; setIndex < set->second.size(); ++setIndex)
61  f(Key(set->first, setIndex), set->second[setIndex]);
62  }
63 
64  void addAttribute(const Key & k, Attribute attr)
65  {
67  if (vec.size() <= k.index)
68  vec.resize(k.index + 1);
69  vec[k.index] = attr;
70  }
71 
72  private:
73  typedef std::vector<Attribute> AttributeVector;
74  typedef std::map<DtFeature::Key::String, AttributeVector> AttributeVectorMap;
75 
78  };
79 }

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)