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 
44  virtual DtTileFeature* clone() const override { return new DtTileFeature(*this); }
45 
46  virtual DtFeatureGeometry geometry() const override { return myGeometry; }
47 
48  virtual void forEachAttribute(ForEachFunction f) const override
49  {
50  f("color", myColor);
51  f("line width", myWidth);
52  }
53 
54  virtual unsigned numberOfAttributes(const Key::String& k) const override
55  {
56  if (k == "color")
57  {
58  return 1;
59  }
60 
61  if (k == "line width")
62  {
63  return 1;
64  }
65 
66  return 0;
67  }
68 
69  virtual bool hasAttribute(const Key& k) const override
70  {
71  if (k.index == 0)
72  {
73  if (k.name == "color")
74  {
75  return true;
76  }
77 
78  if (k.name == "line width")
79  {
80  return true;
81  }
82  }
83 
84  return false;
85  }
86 
87  virtual boost::optional<Attribute> attribute(const Key& k) const override
88  {
89  if (k.index == 0)
90  {
91  if (k.name == "color")
92  {
93  return boost::optional<Attribute>(myColor);
94  }
95 
96  if (k.name == "line width")
97  {
98  return boost::optional<Attribute>(myWidth);
99  }
100  }
101 
102  return boost::none_t();
103  }
104 
105  private:
107  const long long myColor;
108  const long long myWidth;
109  };
110 }
111 
const long long myWidth
Definition: tileFeature.h:108
const long long myColor
Definition: tileFeature.h:107
virtual boost::optional< Attribute > attribute(const Key &k) const override
Get attribute at a certain key.
Definition: tileFeature.h:87
Key used to lookup attributes. The DtFeature interface is a dictionary that maps Key objects to attri...
Definition: feature.h:67
Wraps a feature object and makes sure all the callbacks are unhooked correctly In order to wrap a fea...
Definition: feature.h:300
Definition: tileFeature.h:18
static std::unique_ptr< DtFeature > CreateEmptyFeature()
Factory function for creating features with no data.
#define DT_DEFINE_OBJECT_DEBUGGER_NAME(type)
Definition: objectCounter.h:31
Default on in debug, off in release.
Definition: objectCounter.h:27
virtual void forEachAttribute(ForEachFunction f) const override
Calls the provided callback on each attribute.
Definition: tileFeature.h:48
const DtFeatureGeometry myGeometry
Definition: tileFeature.h:106
virtual DtTileFeature * clone() const override
Return a pointer to an object which represents the current feature. In order to enable paging and eff...
Definition: tileFeature.h:44
virtual unsigned numberOfAttributes(const Key::String &k) const override
Number of attributes with a given key.
Definition: tileFeature.h:54
String name
Definition: feature.h:100
unsigned index
Definition: feature.h:101
virtual DtFeatureGeometry geometry() const override
Get the geometry associated with this feature. GIS features each typically each associated with one g...
Definition: tileFeature.h:46
boost::function< void(const Key &, const Attribute &)> ForEachFunction
Callback used to iterating through attributes with ForEachAttribute.
Definition: feature.h:150
virtual bool hasAttribute(const Key &k) const override
Check to see if this feature has an attribute of a specific type.
Definition: tileFeature.h:69
DtTileFeature(const DtTileFeature &f)
Definition: tileFeature.h:36
Case insensitive string.
Definition: feature.h:70
Represents a GIS feature. Features consist of a DtFeatureGeometry (2.5D geometric vector data) and a ...
Definition: feature.h:36
Represents a feature geometry.
Definition: featureGeometry.h:40
DtTileFeature(const DtFeatureGeometry &geom, unsigned color=0xFF00FF, unsigned width=2)
Definition: tileFeature.h:25

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)