ATLAS Offline Software
Loading...
Searching...
No Matches
VP1CylindricalGrid::Imp Class Reference
Collaboration diagram for VP1CylindricalGrid::Imp:

Public Member Functions

 Imp (VP1CylindricalGrid *, SoSeparator *attachsep)
void rebuild3DObjects ()
void updateColour ()

Public Attributes

VP1CylindricalGridtheclass
SoSeparator * attachSep
bool shown
SbColor4f colourAndTransp
double extent
double spacing
SoSeparator * sep
SoPackedColor * circlecol

Detailed Description

Definition at line 35 of file VP1CylindricalGrid.cxx.

Constructor & Destructor Documentation

◆ Imp()

VP1CylindricalGrid::Imp::Imp ( VP1CylindricalGrid * tc,
SoSeparator * attachsep )

Definition at line 74 of file VP1CylindricalGrid.cxx.

Member Function Documentation

◆ rebuild3DObjects()

void VP1CylindricalGrid::Imp::rebuild3DObjects ( )

Definition at line 83 of file VP1CylindricalGrid.cxx.

84{
85 theclass->messageVerbose("(Re)building 3D objects");
86
87 if (sep) {
88 sep->removeAllChildren();
89 } else {
90 sep = new SoSeparator;
91 sep->ref();
92 }
93
94 const bool save = sep->enableNotify(false);
95
96 int nmax; double distmax;
97 if (!VP1Floor::calcParsFromExtentAndSpacing( theclass, extent, spacing, 20/*max lines*/, nmax, distmax )) {
98 nmax = 10;
99 distmax = 10*SYSTEM_OF_UNITS::m;
100 theclass->message("ERROR: Problems calculating nmax/distmax.");
101 }
102
103 if (!circlecol) {
104 circlecol = new SoPackedColor();
105 circlecol->ref();
106 }
107
108 //Add circles:
109 sep->addChild(circlecol);
110
111 for (int ir=1;ir<=nmax;++ir) {
113 SoSeparator * s = new SoSeparator;
114 SoTranslation *t1= new SoTranslation();
115 t1->translation.setValue(0.0,0.0,-distmax-spacing);
116 s->addChild(t1);
117 for (int iz = -nmax; iz<=nmax; ++iz) {
118 SoTranslation *t2= new SoTranslation();
119 t2->translation.setValue(0.0,0.0,spacing);
120 s->addChild(t2);
121 s->addChild(circle);
122 }
123 sep->addChild(s);
124 }
125
126 //Add lines:
127
128 SoVertexProperty * grid_cylindrical_vertices = new SoVertexProperty();
129
130 int ivert(0);
131 int nsublines(0);
132 static const double invsqrttwo = 1.0/sqrt(2.0);
133 for (int ir=1;ir<=nmax;++ir) {
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);
152 nsublines+=8;
153 }
154
155 grid_cylindrical_vertices->materialBinding=SoMaterialBinding::OVERALL;
156 grid_cylindrical_vertices->normalBinding=SoNormalBinding::OVERALL;
157 SoLineSet * line = new SoLineSet();
158 line->numVertices.enableNotify(FALSE);
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();
165
166 sep->addChild(line);
167 updateColour();
168
169 if (save) {
170 sep->enableNotify(true);
171 sep->touch();
172 }
173
174}
const int nmax(200)
static bool calcParsFromExtentAndSpacing(const VP1HelperClassBase *, const double &extent, const double &spacing, const int &nmaxlimit, int &nmax, double &distmax)
Definition VP1Floor.cxx:30
static SoNode * createCircle(const double &radius)
int ir
counter of the current depth
Definition fastadd.cxx:49
int r
Definition globals.cxx:22
std::vector< ALFA_RawDataContainer_p1 > t2
std::vector< ALFA_RawDataCollection_p1 > t1

◆ updateColour()

void VP1CylindricalGrid::Imp::updateColour ( )

Definition at line 177 of file VP1CylindricalGrid.cxx.

178{
179 theclass->messageVerbose("Updating packed colour");
180 if (circlecol)
181 circlecol->orderedRGBA = colourAndTransp.getPackedValue();
182 if (!sep||sep->getNumChildren()<1)
183 return;
184 SoNode * n = sep->getChild(0);
185 if (!n||n->getTypeId()!=SoLineSet::getClassTypeId())
186 return;
187 SoLineSet * line = static_cast<SoLineSet*>(n);
188 SoVertexProperty * vertices = static_cast<SoVertexProperty *>(line->vertexProperty.getValue());
189 if (vertices)
190 vertices->orderedRGBA = colourAndTransp.getPackedValue();
191}

Member Data Documentation

◆ attachSep

SoSeparator* VP1CylindricalGrid::Imp::attachSep

Definition at line 40 of file VP1CylindricalGrid.cxx.

◆ circlecol

SoPackedColor* VP1CylindricalGrid::Imp::circlecol

Definition at line 48 of file VP1CylindricalGrid.cxx.

◆ colourAndTransp

SbColor4f VP1CylindricalGrid::Imp::colourAndTransp

Definition at line 43 of file VP1CylindricalGrid.cxx.

◆ extent

double VP1CylindricalGrid::Imp::extent

Definition at line 44 of file VP1CylindricalGrid.cxx.

◆ sep

SoSeparator* VP1CylindricalGrid::Imp::sep

Definition at line 47 of file VP1CylindricalGrid.cxx.

◆ shown

bool VP1CylindricalGrid::Imp::shown

Definition at line 42 of file VP1CylindricalGrid.cxx.

◆ spacing

double VP1CylindricalGrid::Imp::spacing

Definition at line 45 of file VP1CylindricalGrid.cxx.

◆ theclass

VP1CylindricalGrid* VP1CylindricalGrid::Imp::theclass

Definition at line 39 of file VP1CylindricalGrid.cxx.


The documentation for this class was generated from the following file: