Import Geant4 3.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:03:00 +02:00
parent cfcb558cfe
commit 137e303ecc
2843 changed files with 37082 additions and 38426 deletions
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.3 1999/12/15 14:54:07 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLImmediateViewer.cc,v 1.3 1999/12/15 14:54:07 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 7th February 1997
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLImmediateWin32.cc,v 1.5 2000/08/19 18:34:26 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// OpenGLImmediateWin32 graphics system factory.
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLImmediateWin32Viewer.cc,v 1.2 1999/12/15 14:54:07 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Class G4OpenGLImmediateWin32Viewer : a class derived from G4OpenGLWin32Viewer and
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLImmediateX.cc,v 1.6 2000/08/19 18:34:28 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 27th March 1996
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLImmediateXViewer.cc,v 1.4 2000/05/22 08:16:25 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 7th February 1997
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLImmediateXm.cc,v 1.5 2000/08/19 18:34:31 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLImmediateXm.cc,v 1.6 2001/02/03 18:39:29 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -31,6 +31,8 @@ G4OpenGLImmediateXm::G4OpenGLImmediateXm ():
G4VisFeaturesOfOpenGLIXm (),
G4VGraphicsSystem::threeD) {}
G4OpenGLImmediateXm::~G4OpenGLImmediateXm () {}
G4VSceneHandler* G4OpenGLImmediateXm::CreateSceneHandler (const G4String& name) {
G4VSceneHandler* pScene = new G4OpenGLImmediateSceneHandler (*this, name);
G4cout << G4OpenGLImmediateSceneHandler::GetSceneCount ()
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLImmediateXmViewer.cc,v 1.3 2000/05/22 08:16:29 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLImmediateXmViewer.cc,v 1.4 2001/02/03 18:39:30 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -79,6 +79,8 @@ G4VViewer (scene, scene.IncrementViewCount (), name) {
// }
}
G4OpenGLImmediateXmViewer::~G4OpenGLImmediateXmViewer () {}
void G4OpenGLImmediateXmViewer::DrawView () {
// If a double buffer context has been forced upon us, ignore the
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLSceneHandler.cc,v 1.5 2000/02/21 16:03:18 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLSceneHandler.cc,v 1.8 2001/01/25 15:28:09 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 27th March 1996
@@ -56,6 +56,25 @@ G4OpenGLSceneHandler::~G4OpenGLSceneHandler ()
ClearStore ();
}
const GLubyte G4OpenGLSceneHandler::fStippleMaskHashed [128] = {
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55
};
//Method for handling G4Polyline objects (from tracking or wireframe).
void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line)
{
@@ -83,7 +102,7 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line)
void G4OpenGLSceneHandler::AddPrimitive (const G4Text& text) {
MarkerSizeType sizeType;
G4double size = GetMarkerSize (text, sizeType);
G4cerr
G4cout
<< "G4OpenGLSceneHandler::AddPrimitive (const G4Text& text) not implemented yet."
<< "\n Called with text \"" << text.GetText ()
<< "\" at " << text.GetPosition ()
@@ -94,137 +113,29 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Text& text) {
}
void G4OpenGLSceneHandler::AddPrimitive (const G4Circle& circle) {
const G4Colour& c = GetColour (circle);
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
if (fpViewer -> GetViewParameters ().IsMarkerNotHidden ())
glDisable (GL_DEPTH_TEST);
else glEnable (GL_DEPTH_TEST);
glDisable (GL_LIGHTING);
G4VMarker::FillStyle style = circle.GetFillStyle();
switch (style) {
case G4VMarker::noFill:
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
break;
case G4VMarker::hashed:
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
glLineStipple (1, 0x0101);
break;
case G4VMarker::filled:
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
break;
default:
G4cerr << "Unrecognised fill style for G4Circle in G4OpenGLSceneHandler."
<< "\nUsing G4VMarker::filled." << G4endl;
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
break;
}
G4Point3D centre = circle.GetPosition();
G4bool userSpecified = (circle.GetWorldSize() || circle.GetScreenSize());
const G4VMarker& def = fpViewer -> GetViewParameters().GetDefaultMarker();
//Make sure we Draw circles...
glEnable (GL_POINT_SMOOTH);
G4double size;
G4double scale = fpViewer -> GetViewParameters().GetGlobalMarkerScale();
if (size = scale * // Assignment intentional.
userSpecified ? circle.GetWorldSize() : def.GetWorldSize()) {
// Draw in world coordinates...
GLdouble winx, winy, winz;
GLdouble* model_matrix = new GLdouble[16];
GLdouble* proj_matrix = new GLdouble[16];
GLint* v_port = new GLint[4];
// glPointSize (5.0); //Still have to work out correspondance between
// //world and screen units.
glGetDoublev (GL_MODELVIEW_MATRIX, model_matrix);
glGetDoublev (GL_PROJECTION_MATRIX, proj_matrix);
glGetIntegerv (GL_VIEWPORT, v_port);
gluProject (size, size, size,
model_matrix,
proj_matrix,
v_port,
&winx, &winy, &winz);
glPointSize (winx);
glBegin (GL_POINTS);
glVertex3d (centre.x(), centre.y(), centre.z());
glEnd ();
delete[] model_matrix;
delete[] proj_matrix;
delete[] v_port;
}
else {
size = scale *
userSpecified ? circle.GetScreenSize() : def.GetScreenSize();
// Draw in screen coordinates...
// G4double* projection_matrix = new G4double[16];
// glGetDoublev (GL_MODELVIEW_MATRIX, projection_matrix);
// HepMatrix proj(4, 4, 1);
// for (col = 1; col < 5; col++) {
// for (row = 1; row < 5; row++) {
// proj (row, col) = projection_matrix[(col-1)*4 + (row-1)];
// }
// }
// G4cout << "proj is : \n" << proj << G4endl;
// proj.invert(ierr);
// G4cout << "ierr is " << ierr << G4endl;
// G4cout << "proj^-1 is : \n" << proj << G4endl;
// for (col = 1; col < 5; col++) {
// for (row = 1; row < 5; row++) {
// projection_matrix[(col-1)*4 + (row-1)] = proj (row, col);
// }
// }
// glMultMatrixd (projection_matrix);
// glTranslated (centre.x(), centre.y(), centre.z());
// glBegin (GL_LINE_LOOP);
glPointSize (size);
glBegin (GL_POINTS);
// for (G4int segment = 0; segment < num_sides; segment++) {
// theta = d_theta * segment;
// glVertex3d (sin(theta) * size,
// cos(theta) * size,
// 0.);
// }
glVertex3d (centre.x(), centre.y(), centre.z());
glEnd ();
}
AddCircleSquare (circle, 24);
}
void G4OpenGLSceneHandler::AddPrimitive (const G4Square& square) {
glDisable (GL_POINT_SMOOTH);
AddCircleSquare (square, 4);
}
void G4OpenGLSceneHandler::AddPrimitive (const G4Square& Square) {
void G4OpenGLSceneHandler::AddCircleSquare
(const G4VMarker& marker,
G4int nSides) {
const G4Colour& c = GetColour (Square);
const G4Colour& c = GetColour (marker);
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
if (fpViewer -> GetViewParameters ().IsMarkerNotHidden ())
glDisable (GL_DEPTH_TEST);
else glEnable (GL_DEPTH_TEST);
glDisable (GL_LIGHTING);
G4VMarker::FillStyle style = Square.GetFillStyle();
G4VMarker::FillStyle style = marker.GetFillStyle();
switch (style) {
case G4VMarker::noFill:
@@ -232,8 +143,16 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Square& Square) {
break;
case G4VMarker::hashed:
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
glLineStipple (1, 0x0101);
/*
G4cout << "Hashed fill style in G4OpenGLSceneHandler."
<< "\n Not implemented. Using G4VMarker::filled."
<< G4endl;
*/
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
glPolygonStipple (fStippleMaskHashed);
// See also:
// if (style == G4VMarker::filled || style == G4VMarker::hashed)...
// (twice) below.
break;
case G4VMarker::filled:
@@ -241,77 +160,165 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Square& Square) {
break;
default:
G4cerr << "Unrecognised fill style for G4Square in G4OpenGLSceneHandler."
<< "\nUsing G4VMarker::filled." << G4endl;
G4cout << "Unrecognised fill style in G4OpenGLSceneHandler."
<< "\n Using G4VMarker::filled."
<< G4endl;
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
break;
}
G4Point3D centre = Square.GetPosition();
// glTranslated (centre.x(), centre.y(), centre.z());
// G4double a = Square.GetWorldSize ();
// if (a <= 0.0) {
// a = 1000.0;
// }
// glBegin (GL_LINE_LOOP);
// glVertex3d ( a, a, 0.);
// glVertex3d (-a, a, 0.);
// glVertex3d (-a, -a, 0.);
// glVertex3d ( a, -a, 0.);
//Make sure we Draw squares...
glDisable (GL_POINT_SMOOTH);
G4bool userSpecified = (Square.GetWorldSize() || Square.GetScreenSize());
// A few useful quantities...
G4Point3D centre = marker.GetPosition();
G4bool userSpecified = (marker.GetWorldSize() || marker.GetScreenSize());
const G4VMarker& def = fpViewer -> GetViewParameters().GetDefaultMarker();
G4double size;
const G4Vector3D& viewpointDirection =
fpViewer -> GetViewParameters().GetViewpointDirection();
const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector();
G4double scale = fpViewer -> GetViewParameters().GetGlobalMarkerScale();
if (size = scale * // Assignment intentional.
userSpecified ? Square.GetWorldSize() : def.GetWorldSize()) {
G4double size = scale *
userSpecified ? marker.GetWorldSize() : def.GetWorldSize();
//Draw in world coordinates...
// Find "size" of marker in world space (but see note below)...
G4double worldSize;
if (size) { // Size specified in world coordinates.
worldSize = size;
}
else { // Size specified in screen (window) coordinates.
// Find window coordinates of centre...
GLdouble modelMatrix[16];
glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
G4double projectionMatrix[16];
glGetDoublev (GL_PROJECTION_MATRIX, projectionMatrix);
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT,viewport);
GLdouble winx, winy, winz;
GLdouble* model_matrix = new GLdouble[16];
GLdouble* proj_matrix = new GLdouble[16];
GLint* v_port = new GLint[4];
// glPointSize (5.0); //Still have to work out correspondance between
// //world and screen units.
glGetDoublev (GL_MODELVIEW_MATRIX, model_matrix);
glGetDoublev (GL_PROJECTION_MATRIX, proj_matrix);
glGetIntegerv (GL_VIEWPORT, v_port);
gluProject (size, size, size,
model_matrix,
proj_matrix,
v_port,
&winx, &winy, &winz);
glPointSize (winx);
// glPointSize (5.0); //Still have to work out correspondance between
// //world units and screen units...
glBegin (GL_POINTS);
glVertex3d (centre.x(), centre.y(), centre.z());
glEnd ();
delete[] model_matrix;
delete[] proj_matrix;
delete[] v_port;
gluProject(centre.x(), centre.y(), centre.z(),
modelMatrix, projectionMatrix, viewport,
&winx, &winy, &winz);
// Determine ratio window:world...
const G4Vector3D inScreen = (up.cross(viewpointDirection)).unit();
const G4Vector3D p = centre + inScreen;
GLdouble winDx, winDy, winDz;
gluProject(p.x(), p.y(), p.z(),
modelMatrix, projectionMatrix, viewport,
&winDx, &winDy, &winDz);
G4double winWorldRatio = sqrt(pow(winx - winDx, 2) +
pow(winy - winDy, 2));
G4double winSize = scale *
userSpecified ? marker.GetScreenSize() : def.GetScreenSize();
worldSize = winSize / winWorldRatio;
}
// Draw...
DrawXYPolygon (worldSize, centre, nSides);
}
/***************************************************
Note: We have to do it this way round so that when a global
transformation is applied, such as with /vis/viewer/set/viewpoint,
the markers follow the world coordinates without having to
recreate the display lists. The down side is that the markers
rotate. The only way to avoid this is to play with the modelview
and projection matrices of OpenGL - which I need to think about.
For future reference, here is the code to draw in window
coordinates; it's down side is tha markers do not follow global
transformations. Some clever stuff is needed.
...
// Find window coordinates of centre...
GLdouble modelMatrix[16];
glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
G4double projectionMatrix[16];
glGetDoublev (GL_PROJECTION_MATRIX, projectionMatrix);
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT,viewport);
GLdouble winx, winy, winz;
gluProject(centre.x(), centre.y(), centre.z(),
modelMatrix, projectionMatrix, viewport,
&winx, &winy, &winz);
// Find window size...
G4double winSize;
if (size) { // Size specified in world coordinates.
// Determine size in window coordinates...
(Note: improve this by using an inScreen vector as above.)
GLdouble winx1, winy1, winz1;
gluProject(centre.x() + size, centre.y() + size, centre.z() + size,
modelMatrix, projectionMatrix, viewport,
&winx1, &winy1, &winz1);
winSize = sqrt((pow(winx - winx1, 2) +
pow(winy - winy1, 2) +
pow(winz - winz1, 2)) / 3.);
}
else {
size = scale *
userSpecified ? Square.GetScreenSize() : def.GetScreenSize();
// Draw in screen coordinates...
glPointSize (size);
glBegin (GL_POINTS);
glVertex3d (centre.x(), centre.y(), centre.z());
glEnd ();
winSize = scale *
userSpecified ? marker.GetScreenSize() : def.GetScreenSize();
}
// Prepare to draw in window coordinates...
glMatrixMode (GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D(GLdouble(viewport[0]),
GLdouble(viewport[0] + viewport[2]),
GLdouble(viewport[1]),
GLdouble(viewport[1] + viewport[3]));
glMatrixMode (GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
// Draw in window coordinates...
DrawScreenPolygon (winSize, G4Point3D(winx, winy, winz), nSides);
// Re-instate matrices...
glMatrixMode (GL_PROJECTION);
glPopMatrix();
glMatrixMode (GL_MODELVIEW);
glPopMatrix();
...
void G4OpenGLSceneHandler::DrawScreenPolygon
(G4double size,
const G4Point3D& centre,
G4int nSides) {
glBegin (GL_POLYGON);
const G4double dPhi = 2. * M_PI / nSides;
const G4double r = size / 2.;
G4double phi;
G4int i;
for (i = 0, phi = -dPhi / 2.; i < nSides; i++, phi += dPhi) {
G4double x, y, z;
x = centre.x() + r * cos(phi);
y = centre.y() + r * sin(phi);
z = centre.z();
glVertex3d (x, y, z);
}
glEnd ();
}
**********************************************/
void G4OpenGLSceneHandler::DrawXYPolygon
(G4double size,
const G4Point3D& centre,
G4int nSides) {
const G4Vector3D& viewpointDirection =
fpViewer -> GetViewParameters().GetViewpointDirection();
const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector();
const G4double dPhi = 2. * M_PI / nSides;
const G4double radius = size / 2.;
G4Vector3D start = radius * (up.cross(viewpointDirection)).unit();
G4double phi;
G4int i;
glBegin (GL_POLYGON);
for (i = 0, phi = -dPhi / 2.; i < nSides; i++, phi += dPhi) {
G4Vector3D r = start; r.rotate(phi, viewpointDirection);
G4Vector3D p = centre + r;
glVertex3d (p.x(), p.y(), p.z());
}
glEnd ();
}
//Method for handling G4Polyhedron objects for drawing solids.
@@ -320,6 +327,8 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
//Assume all facets are convex quadrilaterals.
//Draw each G4Facet individually
if (polyhedron.GetNoFacets() == 0) return;
G4ViewParameters::DrawingStyle drawing_style = GetDrawingStyle (polyhedron);
//Get colour, etc..
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.7 2000/04/12 13:09:07 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.9 2001/02/23 15:43:11 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -63,7 +63,8 @@ void G4OpenGLStoredSceneHandler::BeginPrimitives
G4VSceneHandler::BeginPrimitives (objectTransformation);
if (fMemoryForDisplayLists) {
if (!(fDisplayListId = glGenLists (1))) { // Could pre-allocate?
fDisplayListId = glGenLists (1);
if (!fDisplayListId) { // Could pre-allocate?
G4cout << "********************* WARNING! ********************\n"
<<"Unable to allocate any more display lists in OpenGL.\n "
<< " Continuing drawing in IMMEDIATE MODE.\n"
@@ -73,8 +74,8 @@ void G4OpenGLStoredSceneHandler::BeginPrimitives
}
if (fMemoryForDisplayLists) {
if (fReadyForTransients) {
fTODLList.append (fDisplayListId);
fTODLTransformList.append (objectTransformation);
fTODLList.push_back (fDisplayListId);
fTODLTransformList.push_back (objectTransformation);
glDrawBuffer (GL_FRONT);
glPushMatrix();
G4OpenGLTransform3D oglt (objectTransformation);
@@ -82,8 +83,8 @@ void G4OpenGLStoredSceneHandler::BeginPrimitives
glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
}
else {
fPODLList.append (fDisplayListId);
fPODLTransformList.append (objectTransformation);
fPODLList.push_back (fDisplayListId);
fPODLTransformList.push_back (objectTransformation);
glNewList (fDisplayListId, GL_COMPILE);
}
} else {
@@ -113,16 +114,16 @@ void G4OpenGLStoredSceneHandler::ClearStore () {
int i;
// Delete OpenGL display lists.
for (i = 0; i < fPODLList.entries (); i++) {
if (fPODLList (i)) {
glDeleteLists (fPODLList (i), 1);
for (i = 0; i < fPODLList.size (); i++) {
if (fPODLList [i]) {
glDeleteLists (fPODLList [i], 1);
} else {
G4cerr << "Warning : NULL display List in fPODLList." << G4endl;
}
}
for (i = 0; i < fTODLList.entries (); i++) {
if (fTODLList (i)) {
glDeleteLists (fTODLList (i), 1);
for (i = 0; i < fTODLList.size (); i++) {
if (fTODLList [i]) {
glDeleteLists (fTODLList [i], 1);
} else {
G4cerr << "Warning : NULL display List in fTODLList." << G4endl;
}
@@ -157,11 +158,11 @@ void G4OpenGLStoredSceneHandler::EndModeling () {
// }
glNewList (fTopPODL, GL_COMPILE); {
for (int i = 0; i < fPODLList.entries (); i++) {
for (int i = 0; i < fPODLList.size (); i++) {
glPushMatrix();
G4OpenGLTransform3D oglt (fPODLTransformList (i));
G4OpenGLTransform3D oglt (fPODLTransformList [i]);
glMultMatrixd (oglt.GetGLMatrix ());
glCallList (fPODLList(i));
glCallList (fPODLList[i]);
glPopMatrix();
}
}
@@ -187,8 +188,8 @@ void G4OpenGLStoredSceneHandler::RequestPrimitives (const G4VSolid& solid) {
if (!(fpCurrentPV -> IsReplicated ()) &&
(fSolidMap.find (pSolid) != fSolidMap.end ())) {
fDisplayListId = fSolidMap [pSolid];
fPODLList.append (fDisplayListId);
fPODLTransformList.append (*fpObjectTransformation);
fPODLList.push_back (fDisplayListId);
fPODLTransformList.push_back (*fpObjectTransformation);
}
else {
G4VSceneHandler::RequestPrimitives (solid);
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLStoredViewer.cc,v 1.4 1999/12/15 14:54:08 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLStoredViewer.cc,v 1.5 2001/02/23 15:43:12 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 7th February 1997
@@ -54,8 +54,8 @@ void G4OpenGLStoredViewer::KernelVisitDecision () {
(lastVP.IsSection () != fVP.IsSection ()) ||
// No need if section plane changes.
(lastVP.IsCutaway () != fVP.IsCutaway ()) ||
(lastVP.GetCutawayPlanes ().entries () !=
fVP.GetCutawayPlanes ().entries ()) ||
(lastVP.GetCutawayPlanes ().size () !=
fVP.GetCutawayPlanes ().size ()) ||
// No need if cutaway planes change.
(lastVP.IsExplode () != fVP.IsExplode ()) ||
(lastVP.GetNoOfSides () != fVP.GetNoOfSides ())
@@ -81,12 +81,12 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
if (fSceneHandler.fTopPODL) glCallList (fSceneHandler.fTopPODL);
G4int nTODLs = fSceneHandler.fTODLList.entries ();
G4int nTODLs = fSceneHandler.fTODLList.size ();
for (int i = 0; i < nTODLs; i++) {
glPushMatrix();
G4OpenGLTransform3D oglt (fSceneHandler.fTODLTransformList (i));
G4OpenGLTransform3D oglt (fSceneHandler.fTODLTransformList [i]);
glMultMatrixd (oglt.GetGLMatrix ());
glCallList (fSceneHandler.fTODLList(i));
glCallList (fSceneHandler.fTODLList[i]);
glPopMatrix();
}
}
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLStoredWin32.cc,v 1.5 2000/08/19 18:34:33 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// OpenGLStoredWin32 graphics system factory.
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLStoredWin32Viewer.cc,v 1.2 1999/12/15 14:54:08 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Class G4OpenGLStoredWin32Viewer : a class derived from G4OpenGLWin32Viewer and
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLStoredX.cc,v 1.6 2000/08/19 18:34:36 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLStoredXViewer.cc,v 1.4 2000/05/22 08:16:36 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 7th February 1997
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLStoredXm.cc,v 1.5 2000/08/19 18:34:38 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLStoredXmViewer.cc,v 1.3 2000/05/22 08:16:42 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLStoredXmViewer.cc,v 1.4 2001/02/03 18:39:33 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -59,6 +59,8 @@ G4VViewer (scene, scene.IncrementViewCount (), name) {
glShadeModel (GL_FLAT);
}
G4OpenGLStoredXmViewer::~G4OpenGLStoredXmViewer () {}
void G4OpenGLStoredXmViewer::DrawView () {
if (white_background == true) {
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLTransform3D.cc,v 1.3 1999/12/15 14:54:08 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 24th October 1996
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLViewer.cc,v 1.8 2000/05/22 08:09:15 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLViewer.cc,v 1.10 2001/02/04 20:24:38 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 27th March 1996
@@ -49,6 +49,10 @@ transparency_enabled (False),
antialiasing_enabled (False),
haloing_enabled (False)
{
// Make changes to view parameters for OpenGL...
fVP.SetAutoRefresh(true);
fDefaultVP.SetAutoRefresh(true);
// glClearColor (0.0, 0.0, 0.0, 0.0);
// glClearDepth (1.0);
// glDisable (GL_BLEND);
@@ -98,7 +102,7 @@ void G4OpenGLViewer::SetView () {
// Get radius of scene, etc.
// Note that this procedure properly takes into account zoom, dolly and pan.
const G4Point3D& targetPoint
const G4Point3D targetPoint
= fSceneHandler.GetScene()->GetStandardTargetPoint()
+ fVP.GetCurrentTargetPoint ();
G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLWin32Viewer.cc,v 1.2 1999/12/15 14:54:09 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// G4OpenGLWin32Viewer : Class to provide WindowsNT specific
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLXViewer.cc,v 1.8 2000/05/22 08:07:20 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLXViewer.cc,v 1.9 2001/02/03 18:39:37 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 7th February 1997
@@ -260,14 +260,16 @@ vectored_ps (true)
<< G4endl;
}
if (vi_immediate = vi_single_buffer) {
if (vi_single_buffer) {
vi_immediate = vi_single_buffer;
attributeList = snglBuf_RGBA;
doublebuffer = false;
}
if (!vi_immediate){
// next try for a double buffered RGB, but Draw to top buffer
if (vi_immediate = vi_double_buffer) {
if (vi_double_buffer) {
vi_immediate = vi_double_buffer;
attributeList = dblBuf_RGBA;
doublebuffer = true;
}
@@ -275,11 +277,19 @@ vectored_ps (true)
// Now try for a visual suitable for OpenGLStored...
// Try for a double buffered RGB window
if (vi_stored = vi_double_buffer) {
if (vi_double_buffer) {
vi_stored = vi_double_buffer;
attributeList = dblBuf_RGBA;
doublebuffer = true;
}
if (!vi_immediate || !vi_stored) {
G4cout <<
"G4OpenGLXViewer::G4OpenGLXViewer: unable to get required visuals."
<< G4endl;
fViewId = -1; // This flags an error.
}
// glClearColor (0., 0., 0., 0.);
// glClearDepth (1.);
@@ -681,8 +691,8 @@ extern "C"
static int
compare(const void *a, const void *b)
{
DepthIndex *p1 = (DepthIndex *) a;
DepthIndex *p2 = (DepthIndex *) b;
const DepthIndex *p1 = (DepthIndex *) a;
const DepthIndex *p2 = (DepthIndex *) b;
GLfloat diff = p2->depth - p1->depth;
if (diff > 0.0) {
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLXmBox.cc,v 1.3 1999/12/15 14:54:09 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLXmBox.cc,v 1.4 2001/03/07 14:56:18 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//Box container class
@@ -17,7 +17,7 @@
#include "G4OpenGLXmVWidgetComponent.hh"
#include "G4OpenGLXmVWidgetShell.hh"
G4OpenGLXmBox::G4OpenGLXmBox (char* n,
G4OpenGLXmBox::G4OpenGLXmBox (const char* n,
G4bool r)
{
name = n;
@@ -76,12 +76,12 @@ Widget* G4OpenGLXmBox::GetPointerToWidget ()
return &box_row_col;
}
char* G4OpenGLXmBox::GetName ()
const char* G4OpenGLXmBox::GetName ()
{
return name;
}
void G4OpenGLXmBox::SetName (char* n)
void G4OpenGLXmBox::SetName (const char* n)
{
name = n;
}
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLXmConvenienceRoutines.cc,v 1.3 1999/12/15 14:54:09 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 16th April 1997
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLXmFourArrowButtons.cc,v 1.3 1999/12/15 14:54:09 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLXmFramedBox.cc,v 1.3 1999/12/15 14:54:09 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLXmFramedBox.cc,v 1.4 2001/03/07 14:56:19 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//Framed box container class
@@ -17,7 +17,7 @@
#include "G4OpenGLXmVWidgetComponent.hh"
#include "G4OpenGLXmVWidgetShell.hh"
G4OpenGLXmFramedBox::G4OpenGLXmFramedBox (char* n,
G4OpenGLXmFramedBox::G4OpenGLXmFramedBox (const char* n,
G4bool r) :
G4OpenGLXmBox (n, r)
{
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.6 2000/05/02 10:09:04 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.7 2001/01/25 12:09:57 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 16th April 1997
@@ -75,15 +75,17 @@ void G4OpenGLXmViewer::actions_callback (Widget w,
rot_cb_list[0].closure = pView;
rot_cb_list[1].callback = NULL;
pView->fprotation_button1 = new G4OpenGLXmRadioButton ("Object",
rot_cb_list,
True,
0);
pView->fprotation_button1 = new G4OpenGLXmRadioButton
("Object",
rot_cb_list,
pView->GetViewParameters().GetLightsMoveWithCamera(),
0);
pView->fprotation_button2 = new G4OpenGLXmRadioButton ("Camera",
rot_cb_list,
False,
1);
pView->fprotation_button2 = new G4OpenGLXmRadioButton
("Camera",
rot_cb_list,
!(pView->GetViewParameters().GetLightsMoveWithCamera()),
1);
pView->fprotation_button_box->AddChild (pView->fprotation_button1);
pView->fprotation_button_box->AddChild (pView->fprotation_button2);
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLXmPanningCallbacks.cc,v 1.4 2000/05/13 10:47:52 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 16th April 1997
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLXmPushButton.cc,v 1.3 1999/12/15 14:54:10 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLXmPushButton.cc,v 1.4 2001/03/07 15:16:28 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//Push button class. Inherits from G4OpenGLXmVWidgetComponent
@@ -18,7 +18,7 @@
#include <X11/Intrinsic.h>
#include "globals.hh"
G4OpenGLXmPushButton::G4OpenGLXmPushButton (char* n,
G4OpenGLXmPushButton::G4OpenGLXmPushButton (const char* n,
XtCallbackRec* c)
{
name = n;
@@ -28,17 +28,17 @@ G4OpenGLXmPushButton::G4OpenGLXmPushButton (char* n,
G4OpenGLXmPushButton::~G4OpenGLXmPushButton ()
{}
void G4OpenGLXmPushButton::SetName (char* n)
void G4OpenGLXmPushButton::SetName (const char* n)
{
name = n;
XmString button_string = XmStringCreateLocalized (name);
XmString button_string = XmStringCreateLocalized ((char*)name);
XtVaSetValues (button,
XmNlabelString, button_string,
NULL);
XmStringFree (button_string);
}
char* G4OpenGLXmPushButton::GetName ()
const char* G4OpenGLXmPushButton::GetName ()
{
return name;
}
@@ -50,7 +50,7 @@ void G4OpenGLXmPushButton::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
ProcesspView ();
parent = container->GetPointerToWidget ();
XmString button_str = XmStringCreateLocalized (name);
XmString button_str = XmStringCreateLocalized ((char*)name);
button = XtVaCreateManagedWidget
(name,
xmPushButtonWidgetClass,
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLXmRadioButton.cc,v 1.3 1999/12/15 14:54:10 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLXmRadioButton.cc,v 1.4 2001/03/07 14:56:19 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//Radio button class. Inherits from G4OpenGLXmVWidgetComponent
@@ -18,7 +18,7 @@
#include <X11/Intrinsic.h>
#include "globals.hh"
G4OpenGLXmRadioButton::G4OpenGLXmRadioButton (char* n,
G4OpenGLXmRadioButton::G4OpenGLXmRadioButton (const char* n,
XtCallbackRec* c,
G4bool d,
G4int num)
@@ -32,17 +32,17 @@ G4OpenGLXmRadioButton::G4OpenGLXmRadioButton (char* n,
G4OpenGLXmRadioButton::~G4OpenGLXmRadioButton ()
{}
void G4OpenGLXmRadioButton::SetName (char* n)
void G4OpenGLXmRadioButton::SetName (const char* n)
{
name = n;
XmString button_string = XmStringCreateLocalized (name);
XmString button_string = XmStringCreateLocalized ((char*)name);
XtVaSetValues (button,
XmNlabelString, button_string,
NULL);
XmStringFree (button_string);
}
char* G4OpenGLXmRadioButton::GetName ()
const char* G4OpenGLXmRadioButton::GetName ()
{
return name;
}
@@ -53,7 +53,7 @@ void G4OpenGLXmRadioButton::AddYourselfTo (G4OpenGLXmVWidgetContainer* container
pView = container->GetView ();
ProcesspView ();
parent = container->GetPointerToWidget ();
XmString button_string = XmStringCreateLocalized (name);
XmString button_string = XmStringCreateLocalized ((char*)name);
button = XtVaCreateManagedWidget (name,
xmToggleButtonWidgetClass,
*parent,
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLXmRotationCallbacks.cc,v 1.7 2000/05/13 10:48:03 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLXmRotationCallbacks.cc,v 1.8 2001/01/25 12:09:57 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 16th April 1997
@@ -62,13 +62,12 @@ void G4OpenGLXmViewer::rotate_in_theta (XtPointer clientData,
delta_theta *= deg;
// Rotates by fixed azimuthal angle delta_theta.
G4Vector3D vp = pView->fVP.GetViewpointDirection ().unit ();
G4Vector3D up = pView->fVP.GetUpVector ().unit ();
G4Vector3D& zprime = up;
const G4Vector3D& vp = pView->fVP.GetViewpointDirection ().unit ();
const G4Vector3D& up = pView->fVP.GetUpVector ().unit ();
const G4Vector3D& zprime = up;
G4double cosalpha = up.dot (vp);
G4double sinalpha = sqrt (1. - pow (cosalpha, 2));
G4Vector3D viewPoint = pView->fVP.GetViewpointDirection ().unit ();
G4Vector3D yprime = (zprime.cross (viewPoint)).unit ();
G4Vector3D yprime = (zprime.cross (vp)).unit ();
G4Vector3D xprime = yprime.cross (zprime);
// Projection of vp on plane perpendicular to up...
G4Vector3D a1 = sinalpha * xprime;
@@ -78,7 +77,7 @@ void G4OpenGLXmViewer::rotate_in_theta (XtPointer clientData,
// Required Increment vector...
G4Vector3D delta = a2 - a1;
// So new viewpoint is...
viewPoint += delta;
G4Vector3D viewPoint = vp + delta;
pView->fVP.SetViewAndLights (viewPoint);
@@ -132,10 +131,10 @@ void G4OpenGLXmViewer::rotate_in_phi (XtPointer clientData,
delta_alpha *= deg;
G4Vector3D vp = pView->fVP.GetViewpointDirection ().unit ();
G4Vector3D up = pView->fVP.GetUpVector ().unit ();
const G4Vector3D& vp = pView->fVP.GetViewpointDirection ().unit ();
const G4Vector3D& up = pView->fVP.GetUpVector ().unit ();
G4Vector3D xprime = vp;
const G4Vector3D& xprime = vp;
G4Vector3D yprime = (up.cross(xprime)).unit();
G4Vector3D zprime = (xprime.cross(yprime)).unit();
@@ -143,6 +142,11 @@ void G4OpenGLXmViewer::rotate_in_phi (XtPointer clientData,
pView->fVP.SetViewAndLights (new_vp.unit());
if (pView->fVP.GetLightsMoveWithCamera()) {
G4Vector3D new_up = (new_vp.cross(yprime)).unit();
pView->fVP.SetUpVector(new_up);
}
pView->SetView ();
pView->ClearView ();
pView->DrawView ();
@@ -228,8 +232,8 @@ void G4OpenGLXmViewer::wobble_timer_callback (XtPointer clientData,
XtIntervalId*)
{
G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
G4Vector3D up = pView->fVP.GetUpVector();
G4Vector3D vp = pView->fVP.GetViewpointDirection();
const G4Vector3D& up = pView->fVP.GetUpVector();
const G4Vector3D& vp = pView->fVP.GetViewpointDirection();
G4Vector3D third_axis = up.cross(pView->original_vp);
G4double pi_div_by_ten = M_PI / 10.0;
G4Vector3D d_up = 0.1 * (sin ((G4double)pView->frameNo * pi_div_by_ten * 2.)) * up;
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLXmSeparator.cc,v 1.3 1999/12/15 14:54:10 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//Separator class. Inherits from G4OpenGLXmVWidgetComponent
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLXmSliderBar.cc,v 1.3 1999/12/15 14:54:10 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLXmSliderBar.cc,v 1.4 2001/03/07 14:56:20 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//Slider bar class. Inherits from G4OpenGLXmVWidgetComponent
@@ -19,7 +19,7 @@
#include <Xm/Scale.h>
#include "globals.hh"
G4OpenGLXmSliderBar::G4OpenGLXmSliderBar (char* n,
G4OpenGLXmSliderBar::G4OpenGLXmSliderBar (const char* n,
XtCallbackRec* c,
G4bool s,
short dp,
@@ -43,7 +43,7 @@ G4OpenGLXmSliderBar::G4OpenGLXmSliderBar (char* n,
G4OpenGLXmSliderBar::~G4OpenGLXmSliderBar ()
{}
char* G4OpenGLXmSliderBar::GetName ()
const char* G4OpenGLXmSliderBar::GetName ()
{
return name;
}
@@ -83,10 +83,10 @@ unsigned char G4OpenGLXmSliderBar::GetDirection ()
return direction;
}
void G4OpenGLXmSliderBar::SetName (char* n)
void G4OpenGLXmSliderBar::SetName (const char* n)
{
name = n;
XmString sliderbar_string = XmStringCreateLocalized (name);
XmString sliderbar_string = XmStringCreateLocalized ((char*)name);
XtVaSetValues (sliderbar,
XmNlabelString, sliderbar_string,
NULL);
@@ -163,7 +163,7 @@ void G4OpenGLXmSliderBar::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
ProcesspView ();
parent = container->GetPointerToWidget ();
XmString name_string = XmStringCreateLocalized (name);
XmString name_string = XmStringCreateLocalized ((char*)name);
sliderbar = XtVaCreateManagedWidget (name,
xmScaleWidgetClass,
*parent,
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLXmStyleCallbacks.cc,v 1.3 1999/12/15 14:54:10 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 16th April 1997
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLXmTextField.cc,v 1.3 1999/12/15 14:54:10 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLXmTextField.cc,v 1.4 2001/03/07 14:56:20 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//Text field class. Inherits from G4OpenGLXmVWidgetComponent
@@ -18,7 +18,7 @@
#include <X11/Intrinsic.h>
#include "globals.hh"
G4OpenGLXmTextField::G4OpenGLXmTextField (char* n,
G4OpenGLXmTextField::G4OpenGLXmTextField (const char* n,
G4double* val)
{
name = n;
@@ -28,8 +28,8 @@ G4OpenGLXmTextField::G4OpenGLXmTextField (char* n,
text=false;
}
G4OpenGLXmTextField::G4OpenGLXmTextField (char* n,
char* val)
G4OpenGLXmTextField::G4OpenGLXmTextField (const char* n,
const char* val)
{
name = n;
initial = new char[50];
@@ -44,17 +44,17 @@ G4OpenGLXmTextField::~G4OpenGLXmTextField ()
delete[] initial;
}
void G4OpenGLXmTextField::SetName (char* n)
void G4OpenGLXmTextField::SetName (const char* n)
{
name = n;
XmString text_string = XmStringCreateLocalized (name);
XmString text_string = XmStringCreateLocalized ((char*)name);
XtVaSetValues (text_label,
XmNlabelString, text_string,
NULL);
XmStringFree (text_string);
}
char* G4OpenGLXmTextField::GetName ()
const char* G4OpenGLXmTextField::GetName ()
{
return name;
}
@@ -69,7 +69,7 @@ void G4OpenGLXmTextField::SetValue (G4double val)
}
void G4OpenGLXmTextField::SetValue (char* val)
void G4OpenGLXmTextField::SetValue (const char* val)
{
sprintf (initial, "%s", val);
// strcpy (initial, val);
@@ -80,7 +80,7 @@ void G4OpenGLXmTextField::SetValue (char* val)
}
char* G4OpenGLXmTextField::GetValue ()
const char* G4OpenGLXmTextField::GetValue ()
{
return initial;
}
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLXmTopLevelShell.cc,v 1.3 1999/12/15 14:54:10 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//Top level shell class
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLXmVWidgetComponent.cc,v 1.3 1999/12/15 14:54:10 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//Base class for all Motif component widgets
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLXmVWidgetContainer.cc,v 1.3 1999/12/15 14:54:10 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//Base class for all Motif container widgets
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLXmVWidgetObject.cc,v 1.3 1999/12/15 14:54:10 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//Virtual base class for all Motif widgets.
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLXmVWidgetShell.cc,v 1.3 1999/12/15 14:54:10 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//Base class for all Motif shell widgets
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OpenGLXmViewer.cc,v 1.4 2000/05/22 08:14:00 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4OpenGLXmViewer.cc,v 1.6 2001/03/07 15:29:50 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 10th February 1997
@@ -73,7 +73,7 @@ void G4OpenGLXmViewer::GetXmConnection () {
}
// Better to put this in an X11 resource file !!!
interactorManager->PutStringInResourceDatabase ("\
interactorManager->PutStringInResourceDatabase ((char*)"\
*glxarea*width: 500\n\
*glxarea*height: 500\n\
*frame*x: 10\n\
@@ -140,13 +140,13 @@ void G4OpenGLXmViewer::CreateMainWindow () {
NULL);
//*********Create a menu bar for the window********
style_str = XmStringCreateLocalized ("Style");
actions_str = XmStringCreateLocalized ("Actions");
misc_str = XmStringCreateLocalized ("Miscellany");
spec_str = XmStringCreateLocalized ("Special");
style_str = XmStringCreateLocalized ((char*)"Style");
actions_str = XmStringCreateLocalized ((char*)"Actions");
misc_str = XmStringCreateLocalized ((char*)"Miscellany");
spec_str = XmStringCreateLocalized ((char*)"Special");
menubar = XmVaCreateSimpleMenuBar (main_win,
"menubar",
(char*)"menubar",
XmVaCASCADEBUTTON, style_str, 'S',
XmVaCASCADEBUTTON, actions_str, 'A',
XmVaCASCADEBUTTON, misc_str, 'M',
@@ -167,13 +167,13 @@ void G4OpenGLXmViewer::CreateMainWindow () {
//*********Create style pulldown menu on menubar*********
rep_str = XmStringCreateLocalized ("Representation");
draw_str = XmStringCreateLocalized ("Drawing");
bgnd_str = XmStringCreateLocalized ("Background color");
rep_str = XmStringCreateLocalized ((char*)"Representation");
draw_str = XmStringCreateLocalized ((char*)"Drawing");
bgnd_str = XmStringCreateLocalized ((char*)"Background color");
style_cascade = XmVaCreateSimplePulldownMenu
(menubar,
"style",
(char*)"style",
0,
NULL,
XmVaCASCADEBUTTON, rep_str, 'R',
@@ -193,12 +193,12 @@ void G4OpenGLXmViewer::CreateMainWindow () {
// G4cout << "Created Style pulldown menu" << G4endl;
//Add Representation pullright menu to style cascade...
polyhedron_str = XmStringCreateLocalized ("Polyhedron");
nurbs_str = XmStringCreateLocalized ("NURBS");
polyhedron_str = XmStringCreateLocalized ((char*)"Polyhedron");
nurbs_str = XmStringCreateLocalized ((char*)"NURBS");
rep_style_pullright = XmVaCreateSimplePulldownMenu
(style_cascade,
"rep_style",
(char*)"rep_style",
0,
G4OpenGLXmViewer::rep_style_callback,
XmVaRADIOBUTTON, polyhedron_str, 'P', NULL, NULL,
@@ -235,14 +235,14 @@ void G4OpenGLXmViewer::CreateMainWindow () {
// G4cout << "Created Representation pulldown menu" << G4endl;
//Add Drawing pullright menu to style cascade...
wireframe_str = XmStringCreateLocalized ("Wireframe");
hlr_str = XmStringCreateLocalized ("Hidden line removal");
hsr_str = XmStringCreateLocalized ("Hidden surface removal");
hlhsr_str = XmStringCreateLocalized ("Hidden line and surface removal");
wireframe_str = XmStringCreateLocalized ((char*)"Wireframe");
hlr_str = XmStringCreateLocalized ((char*)"Hidden line removal");
hsr_str = XmStringCreateLocalized ((char*)"Hidden surface removal");
hlhsr_str = XmStringCreateLocalized ((char*)"Hidden line and surface removal");
drawing_style_pullright = XmVaCreateSimplePulldownMenu
(style_cascade,
"drawing_style",
(char*)"drawing_style",
1,
G4OpenGLXmViewer::drawing_style_callback,
XmVaRADIOBUTTON, wireframe_str, 'W', NULL, NULL,
@@ -290,12 +290,12 @@ void G4OpenGLXmViewer::CreateMainWindow () {
// G4cout << "Created Drawing pullright menu" << G4endl;
//Add Drawing pullright menu to style cascade...
white_str = XmStringCreateLocalized ("White");
black_str = XmStringCreateLocalized ("Black");
white_str = XmStringCreateLocalized ((char*)"White");
black_str = XmStringCreateLocalized ((char*)"Black");
background_color_pullright = XmVaCreateSimplePulldownMenu
(style_cascade,
"background_color",
(char*)"background_color",
2,
G4OpenGLXmViewer::background_color_callback,
XmVaRADIOBUTTON, white_str, 'W', NULL, NULL,
@@ -330,13 +330,13 @@ void G4OpenGLXmViewer::CreateMainWindow () {
// G4cout << "Created Background color pullright menu" << G4endl;
//*********Create actions pulldown menu on menubar*********
rot_str = XmStringCreateLocalized ("Rotation control panel");
pan_str = XmStringCreateLocalized ("Panning control panel");
set_str = XmStringCreateLocalized ("Set control panel limits");
rot_str = XmStringCreateLocalized ((char*)"Rotation control panel");
pan_str = XmStringCreateLocalized ((char*)"Panning control panel");
set_str = XmStringCreateLocalized ((char*)"Set control panel limits");
actions_cascade = XmVaCreateSimplePulldownMenu
(menubar,
"actions",
(char*)"actions",
1,
G4OpenGLXmViewer::actions_callback,
XmVaPUSHBUTTON, rot_str, 'R', NULL, NULL,
@@ -355,14 +355,14 @@ void G4OpenGLXmViewer::CreateMainWindow () {
XmStringFree (set_str);
G4cout << "Created Actions pulldown menu" << G4endl;
misc_str = XmStringCreateLocalized ("Miscellany control panel");
exit_str = XmStringCreateLocalized ("Exit to G4Vis>");
print_str = XmStringCreateLocalized ("Create .eps file");
misc_str = XmStringCreateLocalized ((char*)"Miscellany control panel");
exit_str = XmStringCreateLocalized ((char*)"Exit to G4Vis>");
print_str = XmStringCreateLocalized ((char*)"Create .eps file");
//*********Create miscellany pulldown menu on menubar*********
misc_cascade = XmVaCreateSimplePulldownMenu
(menubar,
"miscellany",
(char*)"miscellany",
2,
G4OpenGLXmViewer::misc_callback,
XmVaPUSHBUTTON, misc_str, 'M', NULL, NULL,
@@ -381,14 +381,14 @@ void G4OpenGLXmViewer::CreateMainWindow () {
XmStringFree (print_str);
G4cout << "Created Miscellany pulldown menu" << G4endl;
trans_str = XmStringCreateLocalized ("Transparency");
anti_str = XmStringCreateLocalized ("Antialiasing");
halo_str = XmStringCreateLocalized ("Haloing");
trans_str = XmStringCreateLocalized ((char*)"Transparency");
anti_str = XmStringCreateLocalized ((char*)"Antialiasing");
halo_str = XmStringCreateLocalized ((char*)"Haloing");
//*********Create special pulldown menu on menubar*********
spec_cascade = XmVaCreateSimplePulldownMenu
(menubar,
"special",
(char*)"special",
3,
NULL,
XmVaCASCADEBUTTON, trans_str, 'T',
@@ -408,12 +408,12 @@ void G4OpenGLXmViewer::CreateMainWindow () {
// G4cout << "Created Special pulldown menu" << G4endl;
//Add Transparency pullright menu to special cascade...
off_str = XmStringCreateLocalized ("Off");
on_str = XmStringCreateLocalized ("On");
off_str = XmStringCreateLocalized ((char*)"Off");
on_str = XmStringCreateLocalized ((char*)"On");
transparency_pullright = XmVaCreateSimplePulldownMenu
(spec_cascade,
"transparency",
(char*)"transparency",
0,
G4OpenGLXmViewer::transparency_callback,
XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
@@ -445,7 +445,7 @@ void G4OpenGLXmViewer::CreateMainWindow () {
//Add antialias pullright menu to special cascade...
antialias_pullright = XmVaCreateSimplePulldownMenu
(spec_cascade,
"antialias",
(char*)"antialias",
1,
G4OpenGLXmViewer::antialias_callback,
XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
@@ -477,7 +477,7 @@ void G4OpenGLXmViewer::CreateMainWindow () {
//Add Haloing pullright menu to special cascade...
haloing_pullright = XmVaCreateSimplePulldownMenu
(spec_cascade,
"haloing",
(char*)"haloing",
2,
G4OpenGLXmViewer::haloing_callback,
XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
@@ -507,7 +507,8 @@ void G4OpenGLXmViewer::CreateMainWindow () {
}
XtManageChild (menubar);
frame = XtVaCreateManagedWidget ("frame", xmFrameWidgetClass, main_win,
frame = XtVaCreateManagedWidget ((char*)"frame",
xmFrameWidgetClass, main_win,
XtNvisual, vi -> visual,
XtNdepth, vi -> depth,
XtNcolormap, cmap,
@@ -515,7 +516,7 @@ void G4OpenGLXmViewer::CreateMainWindow () {
XtNbackground, bgnd,
NULL);
glxarea = XtVaCreateManagedWidget ("glxarea",
glxarea = XtVaCreateManagedWidget ((char*)"glxarea",
xmDrawingAreaWidgetClass,
frame,
XtNvisual, vi -> visual,
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4OpenGLXmWindowHandlingCallbacks.cc,v 1.3 1999/12/15 14:54:11 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Andrew Walkden 16th June 1997