VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tileFeature.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (c) 2015 MAK Technologies, Inc.
3  * All rights reserved.
4  ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <features/simpleFeature.h>
13 
14 #include <vrfutil/objectCounter.h>
15 
16 namespace MAKVRinTerra
17 {
19  : public DtFeatureWrapper<DtFeature>
20  , public DtObjectDebugger<DtTileFeature>
21  {
22  public:
23  explicit DtTileFeature(
24  const DtFeatureGeometry& geom,
25  unsigned color = 0xFF00FF,
26  unsigned width = 2)
28  , myGeometry(geom)
29  , myColor(color)
30  , myWidth(width)
31  {
32  }
33 
34  explicit DtTileFeature(const DtTileFeature& f)
37  , myColor(f.myColor)
38  , myWidth(f.myWidth)
39  {
40  }
41 
43  {
44  return new DtTileFeature(*this);
45  }
46 
48  {
49  return myGeometry;
50  }
51 
53  {
54  f("color", (int)myColor);
55  f("line width", (int)myWidth);
56  }
57 
58  unsigned numberOfAttributes(const Key::String &k) const
59  {
60  if (k == "color")
61  return 1;
62 
63  if (k == "line width")
64  return 1;
65 
66  return 0;
67  }
68 
69  bool hasAttribute(const Key & k) const
70  {
71  if (k.index == 0)
72  {
73  if (k.name == "color")
74  return true;
75 
76  if (k.name == "line width")
77  return true;
78  }
79 
80  return false;
81  }
82 
83  boost::optional<Attribute> attribute(const Key & k) const
84  {
85  if (k.index == 0)
86  {
87  if (k.name == "color")
88  {
89  return boost::optional<Attribute>((int)myColor);
90  }
91 
92  if (k.name == "line width")
93  {
94  return boost::optional<Attribute>((int)myWidth);
95  }
96  }
97 
98  return boost::none_t();
99  }
100 
101  private:
103  const unsigned myColor;
104  const unsigned myWidth;
105  };
106 }
107 

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)