ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
VP1CartesianGrid::Imp Class Reference
Collaboration diagram for VP1CartesianGrid::Imp:

Public Member Functions

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

Public Attributes

VP1CartesianGridtheclass
 
SoSeparator * attachSep
 
bool shown
 
SbColor4f colourAndTransp
 
double extent
 
double spacing
 
SoSeparator * sep
 

Detailed Description

Definition at line 32 of file VP1CartesianGrid.cxx.

Constructor & Destructor Documentation

◆ Imp()

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

Definition at line 68 of file VP1CartesianGrid.cxx.

69  : theclass(tc), attachSep(as), shown(false),
70  colourAndTransp(SbColor4f(1,1,1,1)),extent(10), spacing(1), sep(0)
71 {
72  attachSep->ref();
73 }

Member Function Documentation

◆ rebuild3DObjects()

void VP1CartesianGrid::Imp::rebuild3DObjects ( )

Definition at line 76 of file VP1CartesianGrid.cxx.

77 {
78  theclass->messageVerbose("(Re)building 3D objects");
79 
80  if (sep) {
81  sep->removeAllChildren();
82  } else {
83  sep = new SoSeparator;
84  sep->ref();
85  }
86 
87  const bool save = sep->enableNotify(false);
88 
89  int nmax; double distmax;
90  if (!VP1Floor::calcParsFromExtentAndSpacing( theclass, extent, spacing, 40/*max lines*/, nmax, distmax )) {
91  nmax = 10;
92  distmax = 10*SYSTEM_OF_UNITS::m;
93  theclass->message("ERROR: Problems calculating nmax/distmax.");
94  }
95 
96  SoVertexProperty * grid_cartesian_vertices = new SoVertexProperty();
97 
98  int ivert(0);
99  int nsublines(0);
100 
101  //First, loop over (x,z) values and add one line parallel with the y-axis through each.
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);
108  ++nsublines;
109  }
110 
111  //Next, loop over y values and add a plane of lines parallel to the x-z plane.
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);
118  ++nsublines;
119  }
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);
124  ++nsublines;
125  }
126  }
127 
128  grid_cartesian_vertices->materialBinding=SoMaterialBinding::OVERALL;
129  grid_cartesian_vertices->normalBinding=SoNormalBinding::OVERALL;
130  SoLineSet * line = new SoLineSet();
131  line->numVertices.enableNotify(FALSE);
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();
138 
139  sep->addChild(line);
140  updateColour();
141 
142  if (save) {
143  sep->enableNotify(true);
144  sep->touch();
145  }
146 
147 }

◆ updateColour()

void VP1CartesianGrid::Imp::updateColour ( )

Definition at line 150 of file VP1CartesianGrid.cxx.

151 {
152  theclass->messageVerbose("Updating packed colour");
153  if (!sep||sep->getNumChildren()<1)
154  return;
155  SoNode * n = sep->getChild(0);
156  if (!n||n->getTypeId()!=SoLineSet::getClassTypeId())
157  return;
158  SoLineSet * line = static_cast<SoLineSet*>(n);
159  SoVertexProperty * vertices = static_cast<SoVertexProperty *>(line->vertexProperty.getValue());
160  if (!vertices)
161  return;
162  vertices->orderedRGBA = colourAndTransp.getPackedValue();
163 }

Member Data Documentation

◆ attachSep

SoSeparator* VP1CartesianGrid::Imp::attachSep

Definition at line 37 of file VP1CartesianGrid.cxx.

◆ colourAndTransp

SbColor4f VP1CartesianGrid::Imp::colourAndTransp

Definition at line 40 of file VP1CartesianGrid.cxx.

◆ extent

double VP1CartesianGrid::Imp::extent

Definition at line 41 of file VP1CartesianGrid.cxx.

◆ sep

SoSeparator* VP1CartesianGrid::Imp::sep

Definition at line 44 of file VP1CartesianGrid.cxx.

◆ shown

bool VP1CartesianGrid::Imp::shown

Definition at line 39 of file VP1CartesianGrid.cxx.

◆ spacing

double VP1CartesianGrid::Imp::spacing

Definition at line 42 of file VP1CartesianGrid.cxx.

◆ theclass

VP1CartesianGrid* VP1CartesianGrid::Imp::theclass

Definition at line 36 of file VP1CartesianGrid.cxx.


The documentation for this class was generated from the following file:
checkFileSG.line
line
Definition: checkFileSG.py:75
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
VP1HelperClassBase::messageVerbose
void messageVerbose(const QString &) const
Definition: VP1HelperClassBase.cxx:78
VP1CartesianGrid::Imp::shown
bool shown
Definition: VP1CartesianGrid.cxx:39
VP1CartesianGrid::Imp::attachSep
SoSeparator * attachSep
Definition: VP1CartesianGrid.cxx:37
VP1CartesianGrid::Imp::extent
double extent
Definition: VP1CartesianGrid.cxx:41
x
#define x
checkTP.save
def save(self, fileName="./columbo.out")
Definition: checkTP.py:178
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
beamspotman.n
n
Definition: beamspotman.py:731
python.Constants.TRUE
bool TRUE
for job options legacy (TODO: get rid of these!) ----------------------—
Definition: Control/AthenaCommon/python/Constants.py:22
VP1Floor::calcParsFromExtentAndSpacing
static bool calcParsFromExtentAndSpacing(VP1HelperClassBase *, const double &extent, const double &spacing, const int &nmaxlimit, int &nmax, double &distmax)
Definition: VP1Floor.cxx:30
SCT_ConditionsData::OVERALL
@ OVERALL
Definition: SCT_ConditionsParameters.h:24
VP1CartesianGrid::Imp::updateColour
void updateColour()
Definition: VP1CartesianGrid.cxx:150
VP1CartesianGrid::Imp::theclass
VP1CartesianGrid * theclass
Definition: VP1CartesianGrid.cxx:36
python.Constants.FALSE
bool FALSE
Definition: Control/AthenaCommon/python/Constants.py:23
y
#define y
VP1CartesianGrid::Imp::spacing
double spacing
Definition: VP1CartesianGrid.cxx:42
VP1CartesianGrid::Imp::sep
SoSeparator * sep
Definition: VP1CartesianGrid.cxx:44
VP1HelperClassBase::message
void message(const QString &) const
Definition: VP1HelperClassBase.cxx:49
VP1CartesianGrid::Imp::colourAndTransp
SbColor4f colourAndTransp
Definition: VP1CartesianGrid.cxx:40
nmax
const int nmax(200)