VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
tileFeature.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (c) 2020 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 #ifdef DtObjectDebugger_Enable
21  , public DtObjectDebugger<DtTileFeature>
22 #endif
23  {
24  public:
25  explicit DtTileFeature(
26  const DtFeatureGeometry& geom,
27  unsigned color = 0xFF00FF,
28  unsigned width = 2)
30  , myGeometry(geom)
31  , myColor(color)
32  , myWidth(width)
33  {
34  }
35 
36  explicit DtTileFeature(const DtTileFeature& f)
39  , myColor(f.myColor)
40  , myWidth(f.myWidth)
41  {
42  }
43 
45  {
46  return new DtTileFeature(*this);
47  }
48 
50  {
51  return myGeometry;
52  }
53 
55  {
56  f("color", myColor);
57  f("line width", myWidth);
58  }
59 
60  unsigned numberOfAttributes(const Key::String &k) const
61  {
62  if (k == "color")
63  return 1;
64 
65  if (k == "line width")
66  return 1;
67 
68  return 0;
69  }
70 
71  bool hasAttribute(const Key & k) const
72  {
73  if (k.index == 0)
74  {
75  if (k.name == "color")
76  return true;
77 
78  if (k.name == "line width")
79  return true;
80  }
81 
82  return false;
83  }
84 
85  boost::optional<Attribute> attribute(const Key & k) const
86  {
87  if (k.index == 0)
88  {
89  if (k.name == "color")
90  {
91  return boost::optional<Attribute>(myColor);
92  }
93 
94  if (k.name == "line width")
95  {
96  return boost::optional<Attribute>(myWidth);
97  }
98  }
99 
100  return boost::none_t();
101  }
102 
103  private:
105  const long long myColor;
106  const long long myWidth;
107  };
108 }
109 
const long long myWidth
Definition: tileFeature.h:106
const long long myColor
Definition: tileFeature.h:105
Key used to lookup attributes. The DtFeature interface is a dictionary that maps Key objects to attri...
Definition: feature.h:68
bool hasAttribute(const Key &k) const
Check to see if this feature has an attribute of a specific type.
Definition: tileFeature.h:71
Wraps a feature object and makes sure all the callbacks are unhooked correctly In order to wrap a fea...
Definition: feature.h:301
unsigned numberOfAttributes(const Key::String &k) const
Number of attributes with a given key.
Definition: tileFeature.h:60
DtTileFeature * clone() const
Return a pointer to an object which represents the current feature. In order to enable paging and eff...
Definition: tileFeature.h:44
Definition: tileFeature.h:18
#define DT_DEFINE_OBJECT_DEBUGGER_NAME(type)
Definition: objectCounter.h:31
Default on in debug, off in release.
Definition: objectCounter.h:27
const DtFeatureGeometry myGeometry
Definition: tileFeature.h:104
void forEachAttribute(ForEachFunction f) const
Calls the provided callback on each attribute.
Definition: tileFeature.h:54
String name
Definition: feature.h:101
unsigned index
Definition: feature.h:102
boost::function< void(const Key &, const Attribute &)> ForEachFunction
Callback used to iterating through attributes with ForEachAttribute.
Definition: feature.h:151
boost::optional< Attribute > attribute(const Key &k) const
Get attribute at a certain key.
Definition: tileFeature.h:85
DtTileFeature(const DtTileFeature &f)
Definition: tileFeature.h:36
DtFeatureGeometry geometry() const
Get the geometry associated with this feature. GIS features each typically each associated with one g...
Definition: tileFeature.h:49
static std::auto_ptr< DtFeature > CreateEmptyFeature()
Factory function for creating features with no data.
Case insensitive string.
Definition: feature.h:71
Represents a GIS feature. Features consist of a DtFeatureGeometry (2.5D geometric vector data) and a ...
Definition: feature.h:37
Represents a feature geometry.
Definition: featureGeometry.h:39
DtTileFeature(const DtFeatureGeometry &geom, unsigned color=0xFF00FF, unsigned width=2)
Definition: tileFeature.h:25

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)