18 #include <Inventor/nodes/SoSeparator.h>
19 #include <Inventor/nodes/SoVertexProperty.h>
20 #include <Inventor/nodes/SoLineSet.h>
21 #include <Inventor/SbColor4f.h>
24 #include "CLHEP/Units/SystemOfUnits.h"
25 #define SYSTEM_OF_UNITS CLHEP
27 #include "GaudiKernel/SystemOfUnits.h"
28 #define SYSTEM_OF_UNITS Gaudi::Units
35 SoSeparator * attachsep);
69 : theclass(tc), attachSep(as), shown(false),
70 colourAndTransp(SbColor4f(1,1,1,1)),extent(10), spacing(1),
sep(0)
78 theclass->messageVerbose(
"(Re)building 3D objects");
81 sep->removeAllChildren();
83 sep =
new SoSeparator;
87 const bool save =
sep->enableNotify(
false);
89 int nmax;
double distmax;
93 theclass->message(
"ERROR: Problems calculating nmax/distmax.");
96 SoVertexProperty * grid_cartesian_vertices =
new SoVertexProperty();
102 for (
int ix = -
nmax; ix<=
nmax; ++ix)
103 for (
int iz = -
nmax; iz<=
nmax; ++iz) {
104 double x = ix*spacing;
105 double z = iz*spacing;
106 grid_cartesian_vertices->vertex.set1Value(ivert++,
x,-distmax,
z);
107 grid_cartesian_vertices->vertex.set1Value(ivert++,
x,+distmax,
z);
112 for (
int iy = -
nmax; iy<=
nmax; ++iy) {
113 double y = iy*spacing;
114 for (
int ix = -
nmax; ix<=
nmax; ++ix) {
115 double x = ix*spacing;
116 grid_cartesian_vertices->vertex.set1Value(ivert++,
x,
y,-distmax);
117 grid_cartesian_vertices->vertex.set1Value(ivert++,
x,
y,+distmax);
120 for (
int iz = -
nmax; iz<=
nmax; ++iz) {
121 double z = iz*spacing;
122 grid_cartesian_vertices->vertex.set1Value(ivert++,-distmax,
y,
z);
123 grid_cartesian_vertices->vertex.set1Value(ivert++,+distmax,
y,
z);
130 SoLineSet *
line =
new SoLineSet();
132 line->numVertices.setNum(nsublines);
133 for (
int i=0;
i<nsublines;++
i)
134 line->numVertices.set1Value(
i,2);
135 line->vertexProperty = grid_cartesian_vertices;
136 line->numVertices.enableNotify(
TRUE);
137 line->numVertices.touch();
143 sep->enableNotify(
true);
152 theclass->messageVerbose(
"Updating packed colour");
153 if (!
sep||
sep->getNumChildren()<1)
155 SoNode *
n =
sep->getChild(0);
156 if (!
n||
n->getTypeId()!=SoLineSet::getClassTypeId())
158 SoLineSet *
line =
static_cast<SoLineSet*
>(
n);
159 SoVertexProperty * vertices =
static_cast<SoVertexProperty *
>(
line->vertexProperty.getValue());
162 vertices->orderedRGBA = colourAndTransp.getPackedValue();