Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
datareps
VariableMesh.cxx
Go to the documentation of this file.
1
12
// for truncation warning in debug mode
13
#ifdef _MSC_VER
14
#include "msdevstudio/MSconfig.h"
15
#endif
16
17
#include "
VariableMesh.h
"
18
19
#include "
projectors/MeshProjector.h
"
20
#include "
reps/ColorBoxPointRep.h
"
21
22
using namespace
hippodraw;
23
24
using
std::string;
25
using
std::vector;
26
27
28
VariableMesh::VariableMesh
( )
29
:
DataRep
()
30
{
31
m_name
=
"Variable Mesh"
;
32
33
MeshProjector
* projector =
new
MeshProjector
();
34
projector->
setXErrorOption
(
false
);
// method not in ProjectorBase
35
projector->
setYErrorOption
(
false
);
36
m_projector
= projector;
37
38
m_rep
=
new
ColorBoxPointRep
( );
39
}
40
41
DataRep
*
VariableMesh::clone
()
42
{
43
return
new
VariableMesh
( *
this
);
44
}
45
51
void
52
VariableMesh::
53
setRepresentation
(
RepBase
* rep )
54
{
55
DataRep::setPointRep
( rep );
56
57
const
vector < string > & bindings =
m_projector
-> getAxisBindings ();
58
59
bool
yes = bindings[3] !=
"nil"
;
60
setErrorDisplay
(
Axes::X
, yes );
61
62
yes = bindings[4] !=
"nil"
;
63
setErrorDisplay
(
Axes::Y
, yes );
64
}
65
66
bool
VariableMesh::acceptFunction
(
int
num )
67
{
68
return
num == 2;
69
}
70
71
bool
72
VariableMesh::
73
hasErrorDisplay
()
const
74
{
75
bool
yes =
true
;
76
77
const
vector < string > & bindings =
m_projector
-> getAxisBindings ();
78
79
// Was 2 and 3, should be a bug
80
yes = bindings[3] !=
"nil"
|| bindings[4] !=
"nil"
;
81
82
return
yes;
83
}
84
85
86
void
87
VariableMesh::
88
setAxisBinding
(
const
std::string & axis,
const
std::string & label )
89
{
90
DataRep::setAxisBinding
( axis, label );
91
92
NTupleProjector
* projector
93
= dynamic_cast <
NTupleProjector
* > (
m_projector
);
94
unsigned
int
index = projector -> indexOfBindingOption ( axis );
95
96
bool
yes = label !=
"nil"
;
97
if
( index == 3 ) {
98
setErrorDisplay
(
Axes::X
, yes );
99
}
100
101
if
( index == 4 ) {
102
setErrorDisplay
(
Axes::Y
, yes );
103
}
104
}
105
106
void
107
VariableMesh::
108
setAxisBindings
(
const
std::vector < std::string > & new_bindings )
109
{
110
DataRep::setAxisBindings
( new_bindings );
111
112
const
vector < string > & bindings =
m_projector
->
getAxisBindings
();
113
bool
yes = bindings[3] !=
"nil"
;
114
setErrorDisplay
(
Axes::X
, yes );
115
116
yes = bindings[4] !=
"nil"
;
117
setErrorDisplay
(
Axes::Y
, yes );
118
}
119
120
bool
121
VariableMesh::
122
hasAxis
(
hippodraw::Axes::Type
axis )
const
123
{
124
return
axis ==
Axes::X
|| axis ==
Axes::Y
|| axis ==
Axes::Z
;
125
}
Generated for HippoDraw Class Library by