VR-Forces 4.1.1 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:
20  {
21  }
22 
24  {
25  f.forEachAttribute(boost::bind(&DtSimpleFeature::addAttribute, this, _1, _2));
26  }
27 
29  {
30  return myGeometry;
31  }
32 
33  unsigned numberOfAttributes(const Key::String & name) const
34  {
35  AttributeVectorMap::const_iterator set = myAttributeVectorMap.find(name);
36  if (set != myAttributeVectorMap.end())
37  return set->second.size();
38 
39  return 0;
40  }
41 
42  boost::optional<Attribute> attribute(const Key & k) const
43  {
44  AttributeVectorMap::const_iterator set = myAttributeVectorMap.find(k.name);
45  if (set != myAttributeVectorMap.end())
46  if (k.index < set->second.size())
47  return set->second[k.index];
48 
49  return boost::optional<Attribute>();
50  }
51 
53  {
54  typedef AttributeVectorMap::const_iterator MapIterator;
55 
56  for (MapIterator set=myAttributeVectorMap.begin(); set != myAttributeVectorMap.end(); ++set)
57  for (unsigned setIndex=0; setIndex < set->second.size(); ++setIndex)
58  f(Key(set->first, setIndex), set->second[setIndex]);
59  }
60 
61 private:
62  typedef std::vector<Attribute> AttributeVector;
63  typedef std::map<DtFeature::Key::String, AttributeVector> AttributeVectorMap;
64 
65  void addAttribute(const Key & k, Attribute attr)
66  {
68  if (vec.size() <= k.index)
69  vec.resize(k.index + 1);
70  vec[k.index] = attr;
71  }
72 
75 };
76 
77 }

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)