VR-Forces 4.6 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
features
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
{
18
class
DtTileFeature
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)
27
:
DtFeatureWrapper
<
DtFeature
>(
DtFeature
::
CreateEmptyFeature
().release())
28
,
myGeometry
(geom)
29
,
myColor
(color)
30
,
myWidth
(width)
31
{
32
}
33
34
explicit
DtTileFeature
(
const
DtTileFeature
& f)
35
:
DtFeatureWrapper
<
DtFeature
>(f)
36
,
myGeometry
(f.
myGeometry
)
37
,
myColor
(f.
myColor
)
38
,
myWidth
(f.
myWidth
)
39
{
40
}
41
42
DtTileFeature
*
clone
()
const
43
{
44
return
new
DtTileFeature
(*
this
);
45
}
46
47
DtFeatureGeometry
geometry
()
const
48
{
49
return
myGeometry
;
50
}
51
52
void
forEachAttribute
(
ForEachFunction
f)
const
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
:
102
const
DtFeatureGeometry
myGeometry
;
103
const
unsigned
myColor
;
104
const
unsigned
myWidth
;
105
};
106
}
107
108
DT_DEFINE_OBJECT_DEBUGGER_NAME
(
MAKVRinTerra::DtTileFeature
);
Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (
www.mak.com
)