19 #include <Inventor/nodes/SoSeparator.h>
20 #include <Inventor/nodes/SoVertexProperty.h>
21 #include <Inventor/nodes/SoLineSet.h>
22 #include <Inventor/nodes/SoTranslation.h>
23 #include <Inventor/nodes/SoPackedColor.h>
24 #include <Inventor/SbColor4f.h>
27 #include "CLHEP/Units/SystemOfUnits.h"
28 #define SYSTEM_OF_UNITS CLHEP
30 #include "GaudiKernel/SystemOfUnits.h"
31 #define SYSTEM_OF_UNITS Gaudi::Units
38 SoSeparator * attachsep);
75 : theclass(tc), attachSep(as), shown(false),
76 colourAndTransp(SbColor4f(1,1,1,1)),extent(10), spacing(1),
85 theclass->messageVerbose(
"(Re)building 3D objects");
88 sep->removeAllChildren();
90 sep =
new SoSeparator;
94 const bool save =
sep->enableNotify(
false);
96 int nmax;
double distmax;
100 theclass->message(
"ERROR: Problems calculating nmax/distmax.");
104 circlecol =
new SoPackedColor();
109 sep->addChild(circlecol);
113 SoSeparator *
s =
new SoSeparator;
114 SoTranslation *
t1=
new SoTranslation();
115 t1->translation.setValue(0.0,0.0,-distmax-spacing);
117 for (
int iz = -
nmax; iz<=
nmax; ++iz) {
118 SoTranslation *
t2=
new SoTranslation();
119 t2->translation.setValue(0.0,0.0,spacing);
128 SoVertexProperty * grid_cylindrical_vertices =
new SoVertexProperty();
132 static const double invsqrttwo = 1.0/sqrt(2.0);
134 double r =
ir*spacing;
135 double r2 =
r*invsqrttwo;
136 grid_cylindrical_vertices->vertex.set1Value(ivert++,
r,0,-distmax);
137 grid_cylindrical_vertices->vertex.set1Value(ivert++,
r,0,+distmax);
138 grid_cylindrical_vertices->vertex.set1Value(ivert++,0,
r,-distmax);
139 grid_cylindrical_vertices->vertex.set1Value(ivert++,0,
r,+distmax);
140 grid_cylindrical_vertices->vertex.set1Value(ivert++,-
r,0,-distmax);
141 grid_cylindrical_vertices->vertex.set1Value(ivert++,-
r,0,+distmax);
142 grid_cylindrical_vertices->vertex.set1Value(ivert++,0,-
r,-distmax);
143 grid_cylindrical_vertices->vertex.set1Value(ivert++,0,-
r,+distmax);
144 grid_cylindrical_vertices->vertex.set1Value(ivert++,r2,r2,-distmax);
145 grid_cylindrical_vertices->vertex.set1Value(ivert++,r2,r2,+distmax);
146 grid_cylindrical_vertices->vertex.set1Value(ivert++,r2,-r2,-distmax);
147 grid_cylindrical_vertices->vertex.set1Value(ivert++,r2,-r2,+distmax);
148 grid_cylindrical_vertices->vertex.set1Value(ivert++,-r2,r2,-distmax);
149 grid_cylindrical_vertices->vertex.set1Value(ivert++,-r2,r2,+distmax);
150 grid_cylindrical_vertices->vertex.set1Value(ivert++,-r2,-r2,-distmax);
151 grid_cylindrical_vertices->vertex.set1Value(ivert++,-r2,-r2,+distmax);
157 SoLineSet *
line =
new SoLineSet();
159 line->numVertices.setNum(nsublines);
160 for (
int i=0;
i<nsublines;++
i)
161 line->numVertices.set1Value(
i,2);
162 line->vertexProperty = grid_cylindrical_vertices;
163 line->numVertices.enableNotify(
TRUE);
164 line->numVertices.touch();
170 sep->enableNotify(
true);
179 theclass->messageVerbose(
"Updating packed colour");
181 circlecol->orderedRGBA = colourAndTransp.getPackedValue();
182 if (!
sep||
sep->getNumChildren()<1)
184 SoNode *
n =
sep->getChild(0);
185 if (!
n||
n->getTypeId()!=SoLineSet::getClassTypeId())
187 SoLineSet *
line =
static_cast<SoLineSet*
>(
n);
188 SoVertexProperty * vertices =
static_cast<SoVertexProperty *
>(
line->vertexProperty.getValue());
190 vertices->orderedRGBA = colourAndTransp.getPackedValue();